╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 82 // probe for a git repo first, then a xit repo. only the work path │ │ 83 // and backend kind are kept; pages re-open the repo on each build. │ │ 84 const local: ui.RepoSource = blk: { │ │ 85 - if (rp.AnyRepo(.git, .{}).open(io, allocator, .{ .path = cwd_path })) |repo| { │ │ 86 - var git_repo = repo; │ │ 87 - defer git_repo.deinit(io, allocator); │ │ 88 - const work_path = switch (git_repo) { │ │ 89 - inline else => |*r| r.core.work_path, │ │ 90 - }; │ │ 91 - break :blk .{ .path = try session_arena.allocator().dupe(u8, work_path), .repo_kind = .git }; │ │ 92 - } else |err| switch (err) { │ │ 93 - error.RepoNotFound => {}, │ │ 94 - else => |e| return e, │ │ 85 + inline for ([_]rp.RepoKind{ .git, .xit }) |probe_kind| { │ │ 86 + if (rp.AnyRepo(probe_kind, .{}).open(io, allocator, .{ .path = cwd_path })) |repo| { │ │ 87 + var opened = repo; │ │ 88 + defer opened.deinit(io, allocator); │ │ 89 + const work_path = switch (opened) { │ │ 90 + inline else => |*r| r.core.work_path, │ │ 91 + }; │ │ 92 + break :blk .{ .path = try session_arena.allocator().dupe(u8, work_path), .repo_kind = probe_kind };│ │ 93 + } else |err| switch (err) { │ │ 94 + error.RepoNotFound => {}, │ │ 95 + else => |e| return e, │ │ 96 + } │ │ 97 } │ │ 96 - var xit_repo = rp.AnyRepo(.xit, .{}).open(io, allocator, .{ .path = cwd_path }) catch |err| switch (err) { │ │ 97 - error.RepoNotFound => { │ │ 98 - try run_opts.err.print("no git or xit repo found in the current directory\n", .{}); │ │ 99 - return error.HandledError; │ │100 - }, │ │101 - else => |e| return e, │ │102 - }; │ │103 - defer xit_repo.deinit(io, allocator); │ │104 - const work_path = switch (xit_repo) { │ │105 - inline else => |*r| r.core.work_path, │ │106 - }; │ │107 - break :blk .{ .path = try session_arena.allocator().dupe(u8, work_path), .repo_kind = .xit }; │ │ 98 + try run_opts.err.print("no git or xit repo found in the current directory\n", .{}); │ │ 99 + return error.HandledError; │ │100 }; │ │101 │ │102 var session = ui.Session{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯