╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │46 has_more: bool, │ │47 }; │ │48 │ │49 -// "owner/name", so the view can build /repo/owner/name/commits/... links. │ │50 -identity: []const u8, │ │49 +// where links and clone commands for this repository are rooted. │ │50 +location: ui.RoutablePage.RepoLocation, │ │51 // the resolved ref/oid this log walks from (the default branch when the route│ │52 // didn't name one), so the page can canonicalize its url to it. │ │53 ref_or_oid: ui.RoutablePage.RefOrOid, │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │88 // the admin db's moment, for resolving author emails to user names (null│ │89 // in local mode, which has no users) │ │90 admin_moment: ?evt.AdminDB.HashMap(.read_only), │ │91 - identity: []const u8, │ │91 + location: ui.RoutablePage.RepoLocation, │ │92 requested_ref_or_oid: ?ui.RoutablePage.RefOrOid, │ │93 requested_value: []const u8, │ │94 content: ui.RoutablePage.RepoCommitsRoute.Content, │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │113 // (NotFound -> 404); the default-branch path falls through to empty. │ │114 const resolved = (try ui.ResolvedRefOrOid(repo_kind, repo_opts).init(repo, io, aa, requested_ref_or_oid, requested_value)) orelse {│ │115 if (requested_ref_or_oid != null) return error.NotFound; │ │116 - return emptyResult(aa, identity, .branch, requested_value, content); │ │116 + return emptyResult(aa, location, .branch, requested_value, content); │ │117 }; │ │118 var start_arr = [1][hex_len]u8{resolved.oid}; │ │119 const start_oids: []const [hex_len]u8 = start_arr[0..1]; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │126 var count: usize = 0; │ │127 var next_start: ?[]const u8 = null; │ │128 { │ │129 - var iter = repo.log(io, gpa, start_oids) catch return emptyResult(aa, identity, resolved.ref_or_oid, resolved.value, content);│ │129 + var iter = repo.log(io, gpa, start_oids) catch return emptyResult(aa, location, resolved.ref_or_oid, resolved.value, content);│ │130 defer iter.deinit(); │ │131 while (try iter.next(gpa)) |commit_object| { │ │132 defer commit_object.deinit(); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │172 } │ │173 │ │174 return .{ │ │175 - .identity = try aa.dupe(u8, identity), │ │175 + .location = try location.dupe(aa), │ │176 .ref_or_oid = resolved.ref_or_oid, │ │177 .ref_or_oid_value = resolved.value, │ │178 .commits = try aa.dupe(Commit, buf[0..count]),│ ╰───────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │183 } │ │184 │ │185 // an empty listing pinned to a ref, for the wasm / no-repo / unresolved paths. │ │186 -pub fn emptyResult(aa: std.mem.Allocator, identity: []const u8, ref_or_oid: ui.RoutablePage.RefOrOid, value: []const u8, content: ui.RoutablePage.RepoCommitsRoute.Content) !Self { │ │186 +pub fn emptyResult(aa: std.mem.Allocator, location: ui.RoutablePage.RepoLocation, ref_or_oid: ui.RoutablePage.RefOrOid, value: []const u8, content: ui.RoutablePage.RepoCommitsRoute.Content) !Self {│ │187 return .{ │ │188 - .identity = try aa.dupe(u8, identity), │ │188 + .location = try location.dupe(aa), │ │189 .ref_or_oid = ref_or_oid, │ │190 .ref_or_oid_value = try aa.dupe(u8, value), │ │191 .commits = &.{}, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │429 │ │430 // the ref banner at the top. │ │431 { │ │432 - var header_view = try Header.View.init(allocator, &data.header, session, data.identity); │ │432 + var header_view = try Header.View.init(allocator, &data.header, session, data.location); │ │433 errdefer header_view.deinit(allocator); │ │434 try outer.children.put(allocator, header_view.getFocus().id, .{ .widget = .{ .repo_commits_header = header_view }, .rect = null, .min_size = .{ .width = null, .height = 3 } });│ │435 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │447 // js off (the browser follows it, rooting the list there); │ │448 // with wasm the click just selects it and swaps the diff pane. │ │449 const content = if (index == 0) data.content else Content{ .diff = .{} }; │ │450 - try addRow(allocator, &list_box, firstLine(commit.message), try commitRowLink(session.page_arena, data.identity, commit, content)); │ │450 + try addRow(allocator, &list_box, firstLine(commit.message), try commitRowLink(session.page_arena, data.location, commit, content)); │ │451 } │ │452 if (data.next_start) |next| { │ │453 - try addRow(allocator, &list_box, "next →", try commitsLink(session.page_arena, data.identity, next, 0, "")); │ │453 + try addRow(allocator, &list_box, "next →", try commitsLink(session.page_arena, data.location, next, 0, "")); │ │454 } │ │455 if (list_box.children.count() > 0) list_box.getFocus().child_id = list_box.children.keys()[0]; │ │456 break :blk try wgt.Scroll(ui.Widget).init(allocator, .{ .box = list_box }, .{ .direction = .vert, .web_native = !session.is_terminal, .fill = true });│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │522 // links to this page filtered to that file, so activating it navigates │ │523 // there. │ │524 fn addPathBox(self: *View, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), path: []const u8, oid: []const u8) !void { │ │525 - const link = try commitsLink(self.session.page_arena, self.data.identity, oid, 0, path); │ │525 + const link = try commitsLink(self.session.page_arena, self.data.location, oid, 0, path); │ │526 var tb = try wgt.TextBox.init(allocator, path, .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none });│ │527 errdefer tb.deinit(allocator); │ │528 tb.getFocus().focusable = true; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │534 // commit's route at `target_start`, so activating it (the host follows the │ │535 // "a:" link) reloads the page on the adjacent window — same on TUI and web. │ │536 fn addNavLink(self: *View, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), label: []const u8, oid: []const u8, target_start: usize, path: []const u8) !void {│ │537 - const link = try commitsLink(self.session.page_arena, self.data.identity, oid, target_start, path); │ │537 + const link = try commitsLink(self.session.page_arena, self.data.location, oid, target_start, path); │ │538 var tb = try wgt.TextBox.init(allocator, label, .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none }); │ │539 errdefer tb.deinit(allocator); │ │540 tb.getFocus().focusable = true; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯