╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │89 const commits_start = switch (route) { │ │90 .repo_commits => |c| c.start, │ │91 else => 0, │ │92 + }; │ │93 + // the file the commits view's diff pane is filtered to ("" = every file). │ │94 + const commits_path = switch (route) { │ │95 + .repo_commits => |c| c.path.slice(), │ │96 + else => "", │ │97 }; │ │98 // the refs tab windows one column at a time: `refs_from` (a url-encoded │ │99 // ref name) roots `refs_kind`'s column, the other stays at its first window.│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │178 if (is_local) try evt.syncLocalEvents(repo_kind, opened.self_repo_opts, io, gpa, opened); │ │179 break :blk .{ │ │180 try Files.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, requested_ref_or_oid, requested_ref_value, files_dir, files_start), │ │176 - try Commits.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, requested_ref_or_oid, requested_ref_value, commits_start), │ │181 + try Commits.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, requested_ref_or_oid, requested_ref_value, commits_start, commits_path),│ │182 try Refs.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, refs_kind, refs_from), │ │183 try Issues.init(repo_kind, opened.self_repo_opts, arena, opened, io, is_local, repo_identity.identity, issues_tag, issues_selected, issues_view), │ │184 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │190 const aa = arena.allocator(); │ │191 break :blk .{ │ │192 try Files.emptyResult(aa, repo_identity.identity, requested_ref_or_oid orelse .branch, requested_ref_value, files_dir), │ │188 - try Commits.emptyResult(aa, repo_identity.identity, requested_ref_or_oid orelse .branch, requested_ref_value), │ │193 + try Commits.emptyResult(aa, repo_identity.identity, requested_ref_or_oid orelse .branch, requested_ref_value, commits_path),│ │194 try Refs.emptyResult(arena, repo_identity.identity, refs_kind, refs_from), │ │195 try Issues.emptyResult(aa, repo_identity.identity, issues_tag, issues_selected, issues_view), │ │196 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │205 // directory route drops it. │ │206 const files_route_start = if (files.selected_file != null) files_start else 0; │ │207 const route_name = (ui.RoutablePage.repoFilesRoute(repo_identity.identity, files.ref_or_oid, files.ref_or_oid_value, files_path, files_route_start) orelse return error.NotFound).repo_files; │ │203 - const commits_route_name = (ui.RoutablePage.repoCommitsRoute(repo_identity.identity, commits.ref_or_oid, commits.ref_or_oid_value, commits_start) orelse return error.NotFound).repo_commits; │ │208 + const commits_route_name = (ui.RoutablePage.repoCommitsRoute(repo_identity.identity, commits.ref_or_oid, commits.ref_or_oid_value, commits_start, commits.path) orelse return error.NotFound).repo_commits;│ │209 │ │210 return .{ │ │211 // files and commits resolve the same ref, so either's serves the header, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │44 // didn't name one), so the page can canonicalize its url to it. │ │45 ref_or_oid: ui.RoutablePage.RefOrOid, │ │46 ref_or_oid_value: []const u8, │ │47 +// the file the top commit's diff is filtered to ("" = every file). │ │48 +path: []const u8 = "", │ │49 commits: []const Commit, │ │50 // the first oid of the next page, or null when this is the last page.│ │51 next_start: ?[]const u8, │ ╰──────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │71 requested_ref_or_oid: ?ui.RoutablePage.RefOrOid, │ │72 requested_value: []const u8, │ │73 start: usize, │ │74 + path: []const u8, │ │75 ) !Self { │ │76 const aa = arena.allocator(); │ │77 const hex_len = ui.ResolvedRefOrOid(repo_kind, repo_opts).hex_len;│ ╰──────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │81 // (NotFound -> 404); the default-branch path falls through to empty. │ │82 const resolved = (try ui.ResolvedRefOrOid(repo_kind, repo_opts).init(repo, io, aa, requested_ref_or_oid, requested_value)) orelse {│ │83 if (requested_ref_or_oid != null) return error.NotFound; │ │81 - return emptyResult(aa, identity, .branch, requested_value); │ │84 + return emptyResult(aa, identity, .branch, requested_value, path); │ │85 }; │ │86 var start_arr = [1][hex_len]u8{resolved.oid}; │ │87 const start_oids: []const [hex_len]u8 = start_arr[0..1]; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 94 var count: usize = 0; │ │ 95 var next_start: ?[]const u8 = null; │ │ 96 { │ │ 94 - var iter = repo.log(io, gpa, start_oids) catch return emptyResult(aa, identity, resolved.ref_or_oid, resolved.value); │ │ 97 + var iter = repo.log(io, gpa, start_oids) catch return emptyResult(aa, identity, resolved.ref_or_oid, resolved.value, path);│ │ 98 defer iter.deinit(); │ │ 99 while (try iter.next(gpa)) |commit_object| { │ │100 defer commit_object.deinit(); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │124 for (buf[0..count], oids[0..count], 0..) |*commit, oid, i| { │ │125 // the selected commit (the first, == start_oid) shows the window the │ │126 // url asks for; the rest show their first window. │ │127 + // the path filter only applies to the top commit (the walk root). │ │128 const window_start = if (i == 0) start else 0; │ │125 - const rendered = renderCommitDiff(repo_kind, repo_opts, io, gpa, aa, repo, oid, window_start, diff_page) catch │ │129 + const rendered = renderCommitDiff(repo_kind, repo_opts, io, gpa, aa, repo, oid, window_start, diff_page, if (i == 0) path else "") catch│ │130 RenderedDiff{ .hunks = &.{}, .has_prev = false, .has_more = false }; │ │131 commit.hunks = rendered.hunks; │ │132 commit.window_start = window_start; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │139 .identity = try aa.dupe(u8, identity), │ │140 .ref_or_oid = resolved.ref_or_oid, │ │141 .ref_or_oid_value = resolved.value, │ │142 + .path = try aa.dupe(u8, path), │ │143 .commits = try aa.dupe(Commit, buf[0..count]), │ │144 .next_start = next_start, │ │145 .header = try Header.init(aa, resolved.ref_or_oid, resolved.value),│ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯