╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │385 const patch_id = evt.parseEventId(id) catch return error.NotFound; │ │386 │ │387 const id_hex = std.fmt.bytesToHex(patch_id, .lower); │ │388 - var target_repo = try rp.Repo(.xit, .{}).open(io, allocator, repo_source.localInitOpts()); │ │388 + var target_repo = try rp.AnyRepo(.xit, .{}).open(io, allocator, repo_source.localInitOpts()); │ │389 defer target_repo.deinit(io, allocator); │ │390 - try pch.publish(.{}, io, allocator, users_dir, admin_repo, &target_repo, .{ │ │391 - .id = id_hex, │ │392 - .user_id = user_id, │ │393 - .repo_id = repo_id, │ │394 - .author = author, │ │395 - .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │396 - }); │ │390 + switch (target_repo) { │ │391 + inline else => |*repo| try pch.publish(repo.self_repo_opts, io, allocator, users_dir, admin_repo, repo, .{ │ │392 + .id = id_hex, │ │393 + .user_id = user_id, │ │394 + .repo_id = repo_id, │ │395 + .author = author, │ │396 + .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │397 + }), │ │398 + } │ │399 } │ │400 │ │401 pub fn mergePatch(data: *const Self, session: *ui.Session, allocator: std.mem.Allocator, author: evt.CommitAuthor, id: []const u8, revision: evt.Patch.MergeRevision) !void {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │406 const patch_id = evt.parseEventId(id) catch return error.NotFound; │ │407 │ │408 const id_hex = std.fmt.bytesToHex(patch_id, .lower); │ │407 - var target_repo = try rp.Repo(.xit, .{}).open(io, allocator, repo_source.localInitOpts()); │ │409 + var target_repo = try rp.AnyRepo(.xit, .{}).open(io, allocator, repo_source.localInitOpts()); │ │410 defer target_repo.deinit(io, allocator); │ │409 - try pch.mergeAndRemoveFork(.{}, io, allocator, users_dir, &target_repo, .{ │ │410 - .id = id_hex, │ │411 - .revision = revision, │ │412 - .author = author, │ │413 - .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │414 - }); │ │411 + switch (target_repo) { │ │412 + inline else => |*repo| try pch.mergeAndRemoveFork(repo.self_repo_opts, io, allocator, users_dir, repo, .{│ │413 + .id = id_hex, │ │414 + .revision = revision, │ │415 + .author = author, │ │416 + .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ │417 + }), │ │418 + } │ │419 } │ │420 │ │421 pub fn editDraft( │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │866 break; │ │867 } │ │868 const path = try fork.forkPath(aa, users_dir, &user_id, &id); │ │865 - var fork_repo = rp.Repo(.xit, .{}).open(io, arena.child_allocator, .{ .path = path, .require_repo_root = true }) catch continue; │ │869 + // a fork shares its target's hash kind │ │870 + var fork_repo = rp.Repo(.xit, .{ .hash = repo_opts.hash }).open(io, arena.child_allocator, .{ .path = path, .require_repo_root = true }) catch continue;│ │871 defer fork_repo.deinit(io, arena.child_allocator); │ │872 const entry = (try loadDraftEntry(repo_kind, repo_opts, arena, io, admin_moment, &fork_repo, target_repo, id, user_name)) orelse continue; │ │873 try items.append(aa, entry); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │886 arena: *std.heap.ArenaAllocator, │ │887 io: std.Io, │ │888 admin_moment: ?evt.AdminDB.HashMap(.read_only), │ │884 - fork_repo: *rp.Repo(.xit, .{}), │ │889 + fork_repo: *rp.Repo(.xit, .{ .hash = repo_opts.hash }),│ │890 target_repo: *rp.Repo(repo_kind, repo_opts), │ │891 id: [evt.event_id_size]u8, │ │892 forker: []const u8, │ ╰────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │894 const aa = arena.allocator(); │ │895 const id_hex = std.fmt.bytesToHex(id, .lower); │ │896 const fork_oid = (try fork_repo.readRef(io, fork.ref)) orelse return null; │ │892 - const moment = evt.currentMoment(.{}, fork_repo) catch return null; │ │893 - const patch = (try evt.Patch.readById(evt.EventDB(.sha1), .sha1, moment, arena, &id)) orelse return null; │ │897 + const moment = evt.currentMoment(.{ .hash = repo_opts.hash }, fork_repo) catch return null; │ │898 + const patch = (try evt.Patch.readById(evt.EventDB(repo_opts.hash), repo_opts.hash, moment, arena, &id)) orelse return null;│ │899 const target_branch = patch.event.target_branch; │ │900 const target_oid = try target_repo.readRef(io, .{ .kind = .head, .name = target_branch }); │ │901 const commit_count: ?u64 = blk: { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │897 - const newest = evt.PatchRev.readNewest(evt.EventDB(.sha1), .sha1, moment, arena) catch break :blk null; │ │902 + const newest = evt.PatchRev.readNewest(evt.EventDB(repo_opts.hash), repo_opts.hash, moment, arena) catch break :blk null;│ │903 break :blk if (newest) |revision| revision.record.commit_count else 0; │ │904 }; │ │905 return .{ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯