╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │323 pub fn run(ctx: @This(), cursor: *DB.Cursor(.read_write)) !void { │ │324 var moment = try DB.HashMap(.read_write).init(cursor.*); │ │325 const state = rp.Repo(.xit, repo_opts).State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; │ │326 - if (!try refreshBranchesInTransaction(ctx.host_kind, repo_opts, state, &moment, ctx.io, ctx.allocator, ctx.updates, ctx.first_parent, ctx.progress_ctx_maybe)) return error.CancelTransaction;│ │326 + if (!try refreshBranchesInTransaction(ctx.host, repo_opts, state, &moment, ctx.io, ctx.allocator, ctx.updates, ctx.first_parent, ctx.progress_ctx_maybe)) return error.CancelTransaction; │ │327 │ │328 // record the user action for undo │ │329 try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action_kind = evt.undo_action } }); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────╮ │340 .core = &repo.core, │ │341 .io = io, │ │342 .allocator = allocator, │ │343 - .host_kind = host_kind, │ │343 + .host = host, │ │344 .updates = updates, │ │345 .first_parent = first_parent, │ │346 .progress_ctx_maybe = progress_ctx_maybe,│ ╰──────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │352 │ │353 // every open patch is checked after the transaction, since a fork's │ │354 // lock has to be taken before the target's │ │355 - if (host_kind == .server) refreshOpenMergeability(repo_opts, io, allocator, repo, updates, progress_ctx_maybe); │ │355 + if (host == .server) refreshOpenMergeability(repo_opts, io, allocator, repo, host.server.users_dir, updates, progress_ctx_maybe);│ │356 return; │ │357 } │ │358 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │371 error.NotFound => break :collect, │ │372 else => return err, │ │373 }; │ │374 - try collectOutdatedBranchPatches(repo_kind, repo_opts, io, allocator, &arena, .{ .core = &repo.core, .extra = .{} }, moment, updates, host_kind, &patches);│ │374 + try collectOutdatedBranchPatches(repo_kind, repo_opts, io, allocator, &arena, .{ .core = &repo.core, .extra = .{} }, moment, updates, host, &patches); │ │375 } │ │376 │ │377 for (patches.keys(), patches.values()) |id, record| { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │378 const author = evt.CommitAuthor{ .name = "haxy", .email = record.author_email orelse "user@haxy" }; │ │379 - writeBranchPatch(host_kind, repo_kind, repo_opts, io, allocator, repo, std.fmt.bytesToHex(id, .lower), record.event, record.event, author) catch |err| {│ │380 - if (host_kind == .server) std.log.warn("failed to refresh branch patch: {s}", .{@errorName(err)}); │ │379 + writeBranchPatch(host, repo_kind, repo_opts, io, allocator, repo, std.fmt.bytesToHex(id, .lower), record.event, record.event, author) catch |err| { │ │380 + if (host == .server) std.log.warn("failed to refresh branch patch: {s}", .{@errorName(err)}); │ │381 }; │ │382 } │ │383 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │484 io: std.Io, │ │485 allocator: std.mem.Allocator, │ │486 target_repo: *rp.Repo(.xit, repo_opts), │ │487 + users_dir: []const u8, │ │488 id: [evt.event_id_size]u8, │ │489 ) void { │ │489 - refreshMergeCheck(repo_opts, io, allocator, target_repo, &id) catch |err| { │ │490 + refreshMergeCheck(repo_opts, io, allocator, target_repo, users_dir, &id) catch |err| {│ │491 std.log.warn("failed to refresh mergeability: {s}", .{@errorName(err)}); │ │492 }; │ │493 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │499 io: std.Io, │ │500 allocator: std.mem.Allocator, │ │501 target_repo: *rp.Repo(.xit, repo_opts), │ │502 + users_dir: []const u8, │ │503 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate,│ │504 progress_ctx_maybe: ?repo_opts.ProgressCtx, │ │505 ) void { │ ╰────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │504 - refreshOpenMergeChecks(repo_opts, io, allocator, target_repo, updates, progress_ctx_maybe) catch |err| { │ │506 + refreshOpenMergeChecks(repo_opts, io, allocator, target_repo, users_dir, updates, progress_ctx_maybe) catch |err| {│ │507 std.log.warn("failed to refresh mergeability: {s}", .{@errorName(err)}); │ │508 }; │ │509 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │513 io: std.Io, │ │514 allocator: std.mem.Allocator, │ │515 target_repo: *rp.Repo(.xit, repo_opts), │ │516 + users_dir: []const u8, │ │517 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate,│ │518 progress_ctx_maybe: ?repo_opts.ProgressCtx, │ │519 ) !void { │ ╰────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │553 │ │554 // refresh each collected patch independently │ │555 for (ids.items) |id| { │ │553 - refreshMergeability(repo_opts, io, allocator, target_repo, id); │ │556 + refreshMergeability(repo_opts, io, allocator, target_repo, users_dir, id); │ │557 progress.report(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch });│ │558 } │ │559 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯