╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │47 │ │48 // every repo route's stored string starts with "owner/name"; the files │ │49 // route additionally encodes a directory, the commits route a start oid. │ │50 - const name = switch (route) { │ │51 - .repo, .repo_commits, .repo_settings, .repo_auth => |n| n, │ │50 + const name_str: []const u8 = switch (route) { │ │51 + .repo, .repo_settings, .repo_auth => |n| n.slice(), │ │52 + .repo_commits => |c| c.name.slice(), │ │53 else => return error.UnexpectedRoute, │ │54 }; │ │54 - const rf = ui.RoutablePage.RepoFiles.parse(name.slice()) orelse return error.NotFound;│ │55 + const rf = ui.RoutablePage.RepoFiles.parse(name_str) orelse return error.NotFound; │ │56 const tag = std.meta.activeTag(route); │ │57 │ │58 // page state lives in the route only for the tab it targets; the other tabs │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │59 // open at their root/first page. │ │60 const files_dir = if (tag == .repo) rf.dir else ""; │ │60 - const commits_start = if (tag == .repo_commits) ui.RoutablePage.repoCommitsStart(name.slice()) else ""; │ │61 + const commits_start = if (tag == .repo_commits) ui.RoutablePage.repoCommitsStart(name_str) else ""; │ │62 + // how many diff hunks the commits view's selected commit shows ("load more"). │ │63 + const commits_after: usize = switch (route) { │ │64 + .repo_commits => |c| c.after, │ │65 + else => 0, │ │66 + }; │ │67 │ │68 const found = (try evt.Repo.readByOwnerAndName(DB, hash_kind, haxy_moment, arena, rf.owner, rf.name)) orelse return error.NotFound;│ │69 const repo = found.repo; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │74 │ │75 // each tab mirror carries this page's route for that tab; tabs not targeted │ │76 // by the incoming route fall back to their root/first-page route. │ │71 - const route_name = if (tag == .repo) name else (ui.RoutablePage.repoFilesRoute(rf.identity, "") orelse return error.NotFound).repo; │ │72 - const commits_route_name = if (tag == .repo_commits) name else (ui.RoutablePage.repoCommitsRoute(rf.identity, "") orelse return error.NotFound).repo_commits; │ │77 + const route_name = (ui.RoutablePage.repoFilesRoute(rf.identity, files_dir) orelse return error.NotFound).repo; │ │78 + const commits_route_name = if (tag == .repo_commits) route.repo_commits.name else (ui.RoutablePage.repoCommitsRoute(rf.identity, "", 0) orelse return error.NotFound).repo_commits.name;│ │79 │ │80 return .{ │ │81 .header = try Header.init(arena, repo.name, owner.name), │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │82 .repo = repo, │ │83 // the repo's event id is the on-disk repo directory name │ │84 .files = try Files.init(arena, session, &found.event_id, rf.identity, files_dir), │ │79 - .commits = try Commits.init(arena, session, &found.event_id, rf.identity, commits_start), │ │85 + .commits = try Commits.init(arena, session, &found.event_id, rf.identity, commits_start, commits_after),│ │86 .settings = Settings.init(), │ │87 .auth = Auth.init(), │ │88 .quit = Quit.init(), │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │176 switch (index) { │ │177 // files/commits carry this page's content route (directory / log │ │178 // page); settings/auth carry only "owner/name". │ │173 - 1 => self.session.data.current_page = .{ .repo_commits = self.data.commits_route_name }, │ │179 + 1 => self.session.data.current_page = .{ .repo_commits = .{ .name = self.data.commits_route_name } },│ │180 2 => self.session.data.current_page = .{ .repo_settings = self.data.identity }, │ │181 3 => self.session.data.current_page = .{ .repo_auth = self.data.identity }, │ │182 // the quit tab is tty-only and not a route, so leave current_page │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯