╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭────────────────────────────────────────────────────────────────────────╮ │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 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────╮ │566 io: std.Io, │ │567 allocator: std.mem.Allocator, │ │568 target_repo: *rp.Repo(.xit, repo_opts),│ │569 + users_dir: []const u8, │ │570 id: *const [evt.event_id_size]u8, │ │571 ) !void { │ │572 const Repo = rp.Repo(.xit, repo_opts); │ ╰────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │581 // acquire fork locks before the target repository lock │ │582 var checks: MergeCheckInputs(repo_opts) = .{}; │ │583 defer checks.deinit(io, allocator); │ │580 - try checks.add(io, allocator, &target_repo.core, id.*, initial.event); │ │584 + try checks.add(io, allocator, &target_repo.core, users_dir, id.*, initial.event);│ │585 │ │586 // cancel the cache transaction when the result is unchanged │ │587 { │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │625 forks: std.AutoArrayHashMapUnmanaged([evt.event_id_size]u8, ?Repo) = .empty, │ │626 const Self = @This(); │ │627 │ │624 - pub fn prepare(self: *Self, io: std.Io, allocator: std.mem.Allocator, repo: *Repo, events: []const evt.EventWithId) !void { │ │628 + pub fn prepare(self: *Self, io: std.Io, allocator: std.mem.Allocator, repo: *Repo, users_dir: []const u8, events: []const evt.EventWithId) !void {│ │629 for (events) |event| { │ │630 if (event.event != .patch) continue; │ │631 const patch = event.event.patch orelse continue; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │628 - try self.add(io, allocator, &repo.core, try evt.parseEventId(&event.id), patch); │ │632 + try self.add(io, allocator, &repo.core, users_dir, try evt.parseEventId(&event.id), patch);│ │633 } │ │634 } │ │635 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │632 - fn add(self: *Self, io: std.Io, allocator: std.mem.Allocator, core: *Repo.Core, id: [evt.event_id_size]u8, patch: evt.Patch) !void { │ │636 + fn add(self: *Self, io: std.Io, allocator: std.mem.Allocator, core: *Repo.Core, users_dir: []const u8, id: [evt.event_id_size]u8, patch: evt.Patch) !void {│ │637 if (patch.source_branch != null) return self.addFork(io, allocator, id, patch, null); │ │638 │ │639 // find the fork through the forker recorded in the target's config │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │642 defer config.deinit(); │ │643 const forker_id = (try fork.readForkerId(&config.sections, &id)) orelse return self.addFork(io, allocator, id, patch, null); │ │644 │ │641 - // the target lives at <users dir>/<owner>/repos/<id> │ │642 - const users_dir = std.fs.path.dirname(std.fs.path.dirname(std.fs.path.dirname(core.work_path) orelse ".") orelse ".") orelse ".";│ │645 const path = try fork.forkPath(allocator, users_dir, &forker_id, &id); │ │646 defer allocator.free(path); │ │647 try self.addFork(io, allocator, id, patch, path); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯