╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │192 │ │193 // the "key:value" segments of a url tail, collected in any order │ │194 const Params = struct { │ │195 - const ParamKey = enum { start, line, branch, tag, object, theirs }; │ │195 + const ParamKey = enum { start, line, branch, tag, object, base, theirs };│ │196 │ │197 // a branch:/tag:/object: param; the value stays url-encoded │ │198 const RefParam = struct { kind: RefOrOid, value: []const u8 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────╮ │270 const tag_filter_seg = @tagName(Params.ParamKey.tag) ++ ":";│ │271 const start_seg = @tagName(Params.ParamKey.start) ++ ":"; │ │272 const line_seg = @tagName(Params.ParamKey.line) ++ ":"; │ │273 + const base_seg = @tagName(Params.ParamKey.base) ++ ":"; │ │274 const theirs_seg = @tagName(Params.ParamKey.theirs) ++ ":"; │ │275 const issue_seg = "issue:"; │ │276 const patch_seg = "patch:"; │ ╰─────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────╮ │344 name: Array(repo_identity_max_len), │ │345 ref_or_oid: ?RefOrOid = null, │ │346 value: Array(ref_route_max_len) = .{}, │ │347 + base_oid: Array(ref_route_max_len) = .{}, │ │348 // what the pane shows for the commit the log walks from.│ │349 content: Content = .{ .diff = .{} }, │ │350 │ ╰──────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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}); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯