╭ changed ────────────╮ │src/ui/Repo/Files.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │49 loaded: bool = false, │ │50 }; │ │51 │ │52 -// where links and clone commands for this repository are rooted. │ │53 -location: ui.RoutablePage.RepoLocation, │ │52 +// where links and clone commands for this repository are rooted, and who views it.│ │53 +handle: ui.RepoHandle, │ │54 // the resolved ref this listing is read at (the default branch when the route │ │55 // didn't name one), so the view's directory links stay pinned to it. │ │56 ref_or_oid: ui.RoutablePage.RefOrOid, │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────╮ │81 repo: *rp.Repo(repo_kind, repo_opts), │ │82 io: std.Io, │ │83 gpa: std.mem.Allocator, │ │84 - location: ui.RoutablePage.RepoLocation,│ │84 + handle: ui.RepoHandle, │ │85 id_hex: []const u8, │ │86 path: []const u8, │ │87 line: usize, │ ╰───────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │89 const id = evt.parseEventId(id_hex) catch return error.NotFound; │ │90 const record = (try evt.readFromRepo(evt.PatchRev, repo_kind, repo_opts, io, gpa, arena, repo, &id)) orelse return error.NotFound;│ │91 if (record.removed) return error.NotFound; │ │92 - var data = try init(repo_kind, repo_opts, arena, repo, io, gpa, location, .object, record.head_tree_oid, path, line, ""); │ │92 + var data = try init(repo_kind, repo_opts, arena, repo, io, gpa, handle, .object, record.head_tree_oid, path, line, ""); │ │93 data.patchrev_id = try arena.allocator().dupe(u8, id_hex); │ │94 return data; │ │95 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 96 │ │ 97 pub fn filesRoute(self: *const Self, path: []const u8, line: usize) ?ui.RoutablePage { │ │ 98 - if (self.patchrev_id) |id| return switch (self.location) { │ │ 98 + if (self.patchrev_id) |id| return switch (self.handle.location) { │ │ 99 .repo => |identity| ui.RoutablePage.repoPatchRevFilesRoute(identity, id, path, line),│ │100 .fork => null, │ │101 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │102 - const route = self.location.filesRoute(self.ref_or_oid, self.ref_or_oid_value, path, line) orelse return null; │ │102 + const route = self.handle.location.filesRoute(self.ref_or_oid, self.ref_or_oid_value, path, line) orelse return null;│ │103 return route.withFind(self.find orelse return route); │ │104 } │ │105 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────╮ │114 repo: *rp.Repo(repo_kind, repo_opts), │ │115 io: std.Io, │ │116 gpa: std.mem.Allocator, │ │117 - location: ui.RoutablePage.RepoLocation, │ │117 + handle: ui.RepoHandle, │ │118 requested_ref_or_oid: ?ui.RoutablePage.RefOrOid,│ │119 requested_value: []const u8, │ │120 path: []const u8, │ ╰─────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │129 // bad url (NotFound -> 404); the default-branch path falls through to empty. │ │130 const resolved = (try ui.ResolvedRefOrOid(repo_kind, repo_opts).init(repo, io, aa, requested_ref_or_oid, requested_value)) orelse {│ │131 if (requested_ref_or_oid != null or term != null) return error.NotFound; │ │132 - return emptyResult(aa, location, .branch, requested_value, path); │ │132 + return emptyResult(aa, handle, .branch, requested_value, path); │ │133 }; │ │134 │ │135 // read just the viewed directory of that tree or commit. building the │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │136 // read-only state mirrors what repo.status does internally, but for an │ │137 // arbitrary commit rather than HEAD. a path that doesn't exist in the tree │ │138 // is a bad url (404). │ │139 - var moment = repo.core.latestMoment() catch return emptyResult(aa, location, resolved.ref_or_oid, resolved.value, path);│ │139 + var moment = repo.core.latestMoment() catch return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, path); │ │140 const state = rp.Repo(repo_kind, repo_opts).State(.read_only){ .core = &repo.core, .extra = .{ .moment = &moment } }; │ │141 │ │142 var entries: std.ArrayList(Entry) = .empty; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────╮ │169 }; │ │170 } │ │171 return .{ │ │172 - .location = try location.dupe(aa), │ │172 + .handle = try handle.dupe(aa), │ │173 .ref_or_oid = resolved.ref_or_oid, │ │174 .ref_or_oid_value = resolved.value,│ │175 .dir = "", │ ╰────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │184 │ │185 var tree_dir = tr.TreeDir(repo_kind, repo_opts).init(state, io, gpa, &resolved.oid, path) catch |err| switch (err) {│ │186 error.TreeEntryNotFound => return error.NotFound, │ │187 - else => return emptyResult(aa, location, resolved.ref_or_oid, resolved.value, path), │ │187 + else => return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, path), │ │188 }; │ │189 defer tree_dir.deinit(); │ │190 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯