╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭────────────────────────────────────────────────╮ │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); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 999 } │ │1000 │ │1001 // remove the consumed draft from the fork │ │1000 - try evt.consume(.server, .fork, .xit, repo_opts, io, allocator, &fork_repo, evt.events_ref, &.{.{ │ │1002 + try evt.consume(.{ .server = .{ .users_dir = users_dir } }, .fork, .xit, repo_opts, io, allocator, &fork_repo, evt.events_ref, &.{.{│ │1003 .id = input.id, │ │1004 .timestamp = input.timestamp, │ │1005 .author = input.author, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1011 if (fork_record.event.stage == .draft) { │ │1012 var published = fork_record.event; │ │1013 published.stage = .publish; │ │1012 - try evt.consume(.server, .user, .xit, evt.user_repo_opts, io, allocator, &user_repo, evt.events_ref, &.{.{ │ │1014 + try evt.consume(.{ .server = .{ .users_dir = users_dir } }, .user, .xit, evt.user_repo_opts, io, allocator, &user_repo, evt.events_ref, &.{.{│ │1015 .id = input.id, │ │1016 .timestamp = input.timestamp, │ │1017 .author = input.author, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1067 patch.target_branch = input.target_branch; │ │1068 │ │1069 // commit the updated draft metadata │ │1068 - try evt.consume(.server, .fork, .xit, repo_opts, io, allocator, &fork_repo, evt.events_ref, &.{.{ │ │1070 + try evt.consume(.{ .server = .{ .users_dir = users_dir } }, .fork, .xit, repo_opts, io, allocator, &fork_repo, evt.events_ref, &.{.{│ │1071 .id = input.id, │ │1072 .timestamp = input.timestamp, │ │1073 .author = input.author, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │1088 const patch_id = try evt.parseEventId(&input.id); │ │1089 errdefer |err| { │ │1090 if (err == error.PatchDataUnavailable or err == error.PatchOutOfDate) { │ │1089 - refreshMergeability(repo_opts, io, allocator, target_repo, patch_id); │ │1091 + refreshMergeability(repo_opts, io, allocator, target_repo, users_dir, patch_id);│ │1092 } │ │1093 } │ │1094 var arena = std.heap.ArenaAllocator.init(allocator); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯