╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │214 const empty = Diff.Window{ .start = start }; │ │215 │ │216 // load the commit so we can diff it against its first parent. │ │211 - var start_oids = [_][xit.hash.hexLen(repo_opts.hash)]u8{oid}; │ │212 - var commit_iter = repo.log(io, gpa, .{ .start_oids = start_oids[0..1] }) catch return empty;│ │217 + var commit_iter = repo.log(io, gpa, .{ .start_oids = &.{oid} }) catch return empty; │ │218 defer commit_iter.deinit(); │ │219 const commit_object = (commit_iter.next(gpa) catch return empty) orelse return empty; │ │220 defer commit_object.deinit(); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │296 } │ │297 │ │298 pub const View = struct { │ │294 - // a vertical stack: the "viewing <ref>" banner on top, then a horizontal │ │299 + // a vertical stack: the ref banner on top, then a horizontal │ │300 // split with the commit list on the left and a diff pane on the right │ │301 // showing the selected commit's diff. │ │302 box: wgt.Box(ui.Widget), // vert: [header_index] = banner, [content_index] = split│ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │337 // js off (the browser follows it, rooting the list there); │ │338 // with wasm the click just selects it and swaps the diff pane. │ │339 const content = if (index == 0) data.content else Content{ .diff = .{} }; │ │335 - try addRow(allocator, &list_box, firstLine(commit.message), try commitRowLink(session.page_arena, data.location, commit, content)); │ │340 + try addRow(allocator, &list_box, firstLine(commit.message), try commitRowLink(session.page_arena, data, commit, content)); │ │341 } │ │342 if (data.next_start) |next| { │ │338 - try addRow(allocator, &list_box, "next →", try commitsLink(session.page_arena, data.location, next, 0, "")); │ │343 + try addRow(allocator, &list_box, "next →", try commitsLink(session.page_arena, data, next, 0, "")); │ │344 } │ │345 if (list_box.children.count() > 0) list_box.getFocus().child_id = list_box.children.keys()[0]; │ │346 break :blk try wgt.Scroll(ui.Widget).init(allocator, .{ .box = list_box }, .{ .direction = .vert, .web_native = !session.is_terminal, .fill = true });│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │395 // commit's route at `target_start`, so activating it (the host follows the │ │396 // "a:" link) reloads the page on the adjacent window — same on TUI and web. │ │397 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 {│ │393 - const link = try commitsLink(self.session.page_arena, self.data.location, oid, target_start, path); │ │398 + const link = try commitsLink(self.session.page_arena, self.data, oid, target_start, path); │ │399 var tb = try wgt.TextBox.init(allocator, label, .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none }); │ │400 errdefer tb.deinit(allocator); │ │401 tb.getFocus().mode = .all; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │426 const cut_short = commit.message_truncated and kind == .preview; │ │427 var tb = try messageBox(allocator, commit.message, if (cut_short) " click or press enter to see more " else ""); │ │428 errdefer tb.deinit(allocator); │ │424 - if (cut_short) tb.getFocus().kind = .{ .custom = try messageLink(self.session.page_arena, self.data.location, commit.oid) };│ │429 + if (cut_short) tb.getFocus().kind = .{ .custom = try messageLink(self.session.page_arena, self.data, commit.oid) }; │ │430 try box.children.put(allocator, tb.getFocus().id, .{ .widget = .{ .text_box = tb }, .rect = null, .min_size = null }); │ │431 } │ │432 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │589 } │ │590 │ │591 try (Diff{ │ │587 - .route = .{ .commit = .{ .location = self.data.location, .oid = commit.oid } }, │ │592 + .route = .{ .commit = .{ .location = self.data.location, .oid = commit.oid, .base_oid = self.data.base_oid } },│ │593 .path = d.path, │ │594 .window = commit.window, │ │595 }).appendWindow(allocator, self.session, inner); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │641 .enter => if (self.selectedCommitIndex() != null) │ │642 self.focusDiff(root_focus) │ │643 else if (self.data.next_start) |next| { │ │639 - if (self.data.location.commitsRoute(.object, next, 0, "")) |route| │ │644 + if (self.data.location.commitsRoute(.object, next, 0, "", self.data.base_oid)) |route|│ │645 try self.session.navigate(route); │ │646 }, │ │647 .arrow_right => self.focusDiff(root_focus), │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │698 }; │ │699 │ │700 // the "a:" navigation link for the commits page walking from commit `oid` within │ │696 -// `location`, windowing the selected commit's diff from hunk `start`, filtered │ │701 +// `data.location`, windowing the selected commit's diff from hunk `start`, filtered │ │702 // to `path` ("" = every file). │ │698 -fn commitsLink(page_arena: *std.heap.ArenaAllocator, location: ui.RoutablePage.RepoLocation, oid: []const u8, start: usize, path: []const u8) ![]const u8 {│ │699 - const route = location.commitsRoute(.object, oid, start, path) orelse return error.RouteTooLong; │ │703 +fn commitsLink(page_arena: *std.heap.ArenaAllocator, data: *const Self, oid: []const u8, start: usize, path: []const u8) ![]const u8 { │ │704 + const route = data.location.commitsRoute(.object, oid, start, path, data.base_oid) orelse return error.RouteTooLong; │ │705 const url = try route.toUrl(page_arena); │ │706 return std.fmt.allocPrint(page_arena.allocator(), "a:{s}", .{url}); │ │707 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │716 │ │717 // the in-page "ai:" anchor for selecting a commit with its current pane content │ │718 // and window. the href is only followed with js off. │ │714 -fn commitRowLink(page_arena: *std.heap.ArenaAllocator, location: ui.RoutablePage.RepoLocation, commit: Commit, content: Content) ![]const u8 {│ │719 +fn commitRowLink(page_arena: *std.heap.ArenaAllocator, data: *const Self, commit: Commit, content: Content) ![]const u8 { │ │720 const route = (switch (content) { │ │716 - .message => location.commitMessageRoute(.object, commit.oid), │ │717 - .diff => |diff| location.commitsRoute(.object, commit.oid, commit.window.start, diff.path), │ │721 + .message => data.location.commitMessageRoute(.object, commit.oid, data.base_oid), │ │722 + .diff => |diff| data.location.commitsRoute(.object, commit.oid, commit.window.start, diff.path, data.base_oid), │ │723 }) orelse return error.RouteTooLong; │ │724 const url = try route.toUrl(page_arena); │ │725 return std.fmt.allocPrint(page_arena.allocator(), "ai:{s}", .{url}); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │726 } │ │727 │ │728 // the "a:" link to the page showing `oid`'s message on its own. │ │724 -fn messageLink(page_arena: *std.heap.ArenaAllocator, location: ui.RoutablePage.RepoLocation, oid: []const u8) ![]const u8 {│ │725 - const route = location.commitMessageRoute(.object, oid) orelse return error.RouteTooLong; │ │729 +fn messageLink(page_arena: *std.heap.ArenaAllocator, data: *const Self, oid: []const u8) ![]const u8 { │ │730 + const route = data.location.commitMessageRoute(.object, oid, data.base_oid) orelse return error.RouteTooLong; │ │731 const url = try route.toUrl(page_arena); │ │732 return std.fmt.allocPrint(page_arena.allocator(), "a:{s}", .{url}); │ │733 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯