╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │263 error.NotFound => return false, │ │264 else => return err, │ │265 }; │ │266 - try collectOutdatedBranchPatches(.xit, repo_opts, io, allocator, &arena, state.readOnly(), events_moment, updates, host_kind, &patches);│ │266 + try collectOutdatedBranchPatches(.xit, repo_opts, io, allocator, &arena, state.readOnly(), events_moment, updates, host, &patches); │ │267 │ │268 const total = patches.count(); │ │269 if (total > 0) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │278 // a branch patch opens no fork, so its checks need no lock of their own │ │279 var checks: MergeCheckInputs(repo_opts) = .{}; │ │280 defer checks.deinit(io, allocator); │ │281 - if (host_kind == .server) try checks.add(io, allocator, state.core, id, record.event); │ │281 + if (host == .server) try checks.add(io, allocator, state.core, host.server.users_dir, id, record.event); │ │282 │ │283 const author = evt.CommitAuthor{ .name = "haxy", .email = record.author_email orelse "user@haxy" }; │ │284 writeBranchPatchInTransaction(repo_opts, state, moment, io, &arena, std.fmt.bytesToHex(id, .lower), record.event, record.event, author, first_parent, &checks) catch |err| {│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │295 // mergeability. this runs after the caller's transaction, and on xit writes│ │296 // every revision in one transaction of its own │ │297 pub fn refreshBranches( │ │298 - host_kind: evt.HostKind, │ │298 + host: evt.Host, │ │299 comptime repo_kind: rp.RepoKind, │ │300 comptime repo_opts: rp.RepoOpts(repo_kind), │ │301 io: std.Io, │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │315 core: *rp.Repo(.xit, repo_opts).Core, │ │316 io: std.Io, │ │317 allocator: std.mem.Allocator, │ │318 - host_kind: evt.HostKind, │ │318 + host: evt.Host, │ │319 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate,│ │320 first_parent: ?[1][hash.hexLen(repo_opts.hash)]u8, │ │321 progress_ctx_maybe: ?repo_opts.ProgressCtx, │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯