╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │417 }; │ │418 } │ │419 │ │418 - pub fn commitsRoute(self: RepoLocation, ref_or_oid: ?RefOrOid, value: []const u8, start: usize, path: []const u8) ?RoutablePage { │ │420 + pub fn commitsRoute(self: RepoLocation, ref_or_oid: ?RefOrOid, value: []const u8, start: usize, path: []const u8, base_oid: []const u8) ?RoutablePage {│ │421 return switch (self) { │ │420 - .repo => |repo_identity| repoCommitsRoute(repo_identity, ref_or_oid, value, start, path), │ │422 + .repo => |repo_identity| repoCommitsRoute(repo_identity, ref_or_oid, value, start, path, base_oid), │ │423 .fork => |f| if (ref_or_oid == null or (ref_or_oid == .branch and std.mem.eql(u8, value, "patch"))) │ │424 forkCommitsRoute(f.identity, f.id, "", start, path) │ │425 else if (ref_or_oid == .object) │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │429 }; │ │430 } │ │431 │ │430 - pub fn commitMessageRoute(self: RepoLocation, ref_or_oid: RefOrOid, value: []const u8) ?RoutablePage { │ │432 + pub fn commitMessageRoute(self: RepoLocation, ref_or_oid: RefOrOid, value: []const u8, base_oid: []const u8) ?RoutablePage {│ │433 return switch (self) { │ │432 - .repo => |repo_identity| repoCommitMessageRoute(repo_identity, ref_or_oid, value), │ │434 + .repo => |repo_identity| repoCommitMessageRoute(repo_identity, ref_or_oid, value, base_oid), │ │435 .fork => |f| if (ref_or_oid == .object) forkCommitMessageRoute(f.identity, f.id, value) else null, │ │436 }; │ │437 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │512 // always carries the `commits` marker so the bare route doesn't collide │ │513 // with the files root. a non-empty `path` filters the diff pane to that │ │514 // file and requires a ref. │ │513 - pub fn repoCommitsRoute(identity: []const u8, ref_or_oid: ?RefOrOid, value: []const u8, start: usize, path: []const u8) ?RoutablePage { │ │515 + pub fn repoCommitsRoute(identity: []const u8, ref_or_oid: ?RefOrOid, value: []const u8, start: usize, path: []const u8, base_oid: []const u8) ?RoutablePage {│ │516 if (ref_or_oid == null and (value.len != 0 or path.len != 0)) return null; │ │517 return .{ .repo_commits = .{ │ │518 .name = Array(repo_identity_max_len).from(identity) orelse return null, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │519 .ref_or_oid = ref_or_oid, │ │520 .value = Array(ref_route_max_len).from(value) orelse return null, │ │521 + .base_oid = Array(ref_route_max_len).from(base_oid) orelse return null,│ │522 .content = .{ .diff = .{ │ │523 .start = start, │ │524 .path = Array(repo_route_max_len).from(path) orelse return null, │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │528 │ │529 // build a `.repo_commits` route showing the ref/oid's commit message in │ │530 // full, which is the only content that page renders. │ │528 - pub fn repoCommitMessageRoute(identity: []const u8, ref_or_oid: RefOrOid, value: []const u8) ?RoutablePage { │ │531 + pub fn repoCommitMessageRoute(identity: []const u8, ref_or_oid: RefOrOid, value: []const u8, base_oid: []const u8) ?RoutablePage {│ │532 if (value.len == 0) return null; │ │533 return .{ .repo_commits = .{ │ │534 .name = Array(repo_identity_max_len).from(identity) orelse return null, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │535 .ref_or_oid = ref_or_oid, │ │536 .value = Array(ref_route_max_len).from(value) orelse return null, │ │537 + .base_oid = Array(ref_route_max_len).from(base_oid) orelse return null,│ │538 .content = .message, │ │539 } }; │ │540 } │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │863 var out: std.Io.Writer.Allocating = .init(arena.allocator()); │ │864 try out.writer.print("{s}/" ++ commits_seg, .{prefix}); │ │865 if (c.ref_or_oid) |kind| if (c.value.len != 0) try out.writer.print("/{s}:{s}", .{ @tagName(kind), c.value.slice() });│ │866 + if (c.base_oid.len != 0) try out.writer.print("/" ++ base_seg ++ "{s}", .{c.base_oid.slice()}); │ │867 switch (c.content) { │ │868 .diff => |d| { │ │869 if (d.start != 0) try out.writer.print("/" ++ start_seg ++ "{d}", .{d.start}); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │1387 } │ │1388 if (std.mem.eql(u8, tab, commits_seg)) { │ │1389 params.scanPairs(&segments) catch return null; │ │1385 - if (!params.only(&.{ .start, .branch, .tag, .object })) return null; │ │1390 + if (!params.only(&.{ .start, .branch, .tag, .object, .base })) return null;│ │1391 + const base_oid = params.values.get(.base) orelse ""; │ │1392 const start = params.start() orelse return null; │ │1393 const ref = (params.ref() catch return null) orelse { │ │1394 const file = pathValue(segments.rest()) orelse return null; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1389 - return if (file.len == 0) repoCommitsRoute(pair, null, "", start, "") else null; │ │1395 + return if (file.len == 0) repoCommitsRoute(pair, null, "", start, "", base_oid) else null; │ │1396 }; │ │1391 - // the message page names its commit and nothing else │ │1397 + // the message page has no diff window or file filter │ │1398 if (std.mem.eql(u8, segments.rest(), message_seg)) │ │1393 - return if (start == 0) repoCommitMessageRoute(pair, ref.kind, ref.value) else null; │ │1399 + return if (start == 0) repoCommitMessageRoute(pair, ref.kind, ref.value, base_oid) else null;│ │1400 const file = pathValue(segments.rest()) orelse return null; │ │1395 - return repoCommitsRoute(pair, ref.kind, ref.value, start, file); │ │1401 + return repoCommitsRoute(pair, ref.kind, ref.value, start, file, base_oid); │ │1402 } │ │1403 return null; // unknown sub-path │ │1404 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1420 .repo_commits => |a_c| std.mem.eql(u8, a_c.name.slice(), b.repo_commits.name.slice()) and │ │1421 a_c.ref_or_oid == b.repo_commits.ref_or_oid and │ │1422 std.mem.eql(u8, a_c.value.slice(), b.repo_commits.value.slice()) and │ │1423 + std.mem.eql(u8, a_c.base_oid.slice(), b.repo_commits.base_oid.slice()) and │ │1424 switch (a_c.content) { │ │1425 .diff => |a_d| switch (b.repo_commits.content) { │ │1426 .diff => |b_d| a_d.start == b_d.start and std.mem.eql(u8, a_d.path.slice(), b_d.path.slice()),│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯