╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1082 const ready_queue_cursor = try map.putCursor(hash.hashInt(repo_opts.hash, "ready-queue"));│ │1083 const ready_queue = try DB.ArrayList(.read_write).init(ready_queue_cursor); │ │1084 │ │ 928 - var self = CommitIterator(repo_opts){ │ │1085 + var self = CommitIterator(repo_kind, repo_opts){ │ │1086 .repo_dir = state.core.repo_dir, │ │1087 .db_file = db_file, │ │1088 .db = db_ptr, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1100 return self; │ │1101 } │ │1102 │ │ 946 - pub fn deinit(self: *CommitIterator(repo_opts), io: std.Io, allocator: std.mem.Allocator) void { │ │1103 + pub fn deinit(self: *CommitIterator(repo_kind, repo_opts), io: std.Io, allocator: std.mem.Allocator) void {│ │1104 self.db_file.close(io); │ │1105 self.db.core.memory.buffer.deinit(); │ │1106 allocator.destroy(self.db.core.memory.buffer); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1108 allocator.destroy(self.db); │ │1109 } │ │1110 │ │ 954 - pub fn next(self: *CommitIterator(repo_opts)) !?[hash.byteLen(repo_opts.hash)]u8 { │ │1111 + pub fn next(self: *CommitIterator(repo_kind, repo_opts)) !?[hash.byteLen(repo_opts.hash)]u8 {│ │1112 if (self.ready_queue_index >= try self.ready_queue.count()) return null; │ │1113 │ │1114 const oid = try readOidFromList(self.ready_queue.readOnly(), self.ready_queue_index); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │1119 } │ │1120 │ │1121 fn collect( │ │ 965 - self: *CommitIterator(repo_opts), │ │ 966 - state: rp.Repo(.xit, repo_opts).State(.read_only), │ │1122 + self: *CommitIterator(repo_kind, repo_opts), │ │1123 + state: rp.Repo(repo_kind, repo_opts).State(.read_only),│ │1124 io: std.Io, │ │1125 allocator: std.mem.Allocator, │ │1126 consumed_object_ids: DB.HashMap(.read_only), │ ╰─────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1135 const seen_object_ids_cursor = try map.putCursor(hash.hashInt(repo_opts.hash, "seen-object-ids")); │ │1136 const seen_object_ids = try DB.HashSet(.read_write).init(seen_object_ids_cursor); │ │1137 │ │ 981 - const head_oid_hex = (try rf.readRecur(.xit, repo_opts, state, io, .{ .ref = ref })) orelse return error.OidNotFound; │ │1138 + const head_oid_hex = (try rf.readRecur(repo_kind, repo_opts, state, io, .{ .ref = ref })) orelse return error.OidNotFound;│ │1139 var head_oid: [hash.byteLen(repo_opts.hash)]u8 = undefined; │ │1140 _ = try std.fmt.hexToBytes(&head_oid, &head_oid_hex); │ │1141 try walk_queue.append(.{ .bytes = &head_oid }); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1153 │ │1154 try seen_object_ids.put(oid_int, .{ .bytes = &oid }); │ │1155 │ │ 999 - var commit_object = try obj.Object(.xit, repo_opts).init(state, io, allocator, &std.fmt.bytesToHex(oid, .lower)); │ │1156 + var commit_object = try obj.Object(repo_kind, repo_opts).init(state, io, allocator, &std.fmt.bytesToHex(oid, .lower));│ │1157 defer commit_object.deinit(); │ │1158 │ │1159 // if this object id has already been consumed, skip it │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1195 } │ │1196 } │ │1197 │ │1041 - fn enqueueChildren(self: *CommitIterator(repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void { │ │1198 + fn enqueueChildren(self: *CommitIterator(repo_kind, repo_opts), oid: *const [hash.byteLen(repo_opts.hash)]u8) !void {│ │1199 const oid_int = hash.bytesToInt(repo_opts.hash, oid); │ │1200 const children_cursor = try self.parent_to_children.getCursor(oid_int) orelse return; │ │1201 const children = try DB.HashSet(.read_only).init(children_cursor); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │79 var session_arena = std.heap.ArenaAllocator.init(allocator); │ │80 defer session_arena.deinit(); │ │81 │ │82 - // probe for a git repo first, then a xit repo. only the work path │ │82 + // probe both backends for a repo; the nearest one wins, so a repo │ │83 + // isn't shadowed by one it is nested inside. only the work path │ │84 // and backend kind are kept; pages re-open the repo on each build. │ │85 const local: ui.RepoSource = blk: { │ │86 + var found: ?ui.RepoSource = null; │ │87 inline for ([_]rp.RepoKind{ .git, .xit }) |probe_kind| { │ │88 if (rp.AnyRepo(probe_kind, .{}).open(io, allocator, .{ .path = cwd_path })) |repo| {│ │89 var opened = repo; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 91 const work_path = switch (opened) { │ │ 92 inline else => |*r| r.core.work_path, │ │ 93 }; │ │ 92 - break :blk .{ .path = try session_arena.allocator().dupe(u8, work_path), .repo_kind = probe_kind }; │ │ 94 + const found_len = if (found) |f| f.path.len else 0; │ │ 95 + if (work_path.len > found_len) { │ │ 96 + found = .{ .path = try session_arena.allocator().dupe(u8, work_path), .repo_kind = probe_kind };│ │ 97 + } │ │ 98 } else |err| switch (err) { │ │ 99 error.RepoNotFound => {}, │ │100 else => |e| return e, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │101 } │ │102 } │ │ 98 - try run_opts.err.print("no git or xit repo found in the current directory\n", .{}); │ │ 99 - return error.HandledError; │ │103 + break :blk found orelse { │ │104 + try run_opts.err.print("no git or xit repo found in the current directory\n", .{});│ │105 + return error.HandledError; │ │106 + }; │ │107 }; │ │108 │ │109 var session = ui.Session{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯