╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯