╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │101 } │ │102 const query: ?[]const u8 = if (search.len == 0) null else std.Uri.percentDecodeInPlace(try aa.dupe(u8, search));│ │103 │ │115 - // the walk root's message replaces its diff, so it's read whole and its │ │116 - // hunks aren't rendered. the window and the filter are its diff's. │ │117 - const root_message = std.meta.activeTag(content) == .message; │ │118 - const root_start: usize = switch (content) { │ │119 - .diff => |d| d.start, │ │120 - .message => 0, │ │121 - }; │ │122 - const root_path: []const u8 = switch (content) { │ │123 - .diff => |*d| d.path.slice(), │ │124 - .message => "", │ │125 - }; │ │126 - │ │104 // resolve the requested ref (or the default branch) to the commit oid to │ │105 // walk from. an explicitly named ref that doesn't resolve is a bad url │ │106 // (NotFound -> 404); the default-branch path falls through to empty. │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │107 var resolved = (try ui.ResolvedRefOrOid(repo_kind, repo_opts).init(repo, io, aa, requested_ref_or_oid, requested_value)) orelse {│ │108 if (requested_ref_or_oid != null) return error.NotFound; │ │132 - var data = try emptyResult(aa, handle, .branch, requested_value, content, base_oid); │ │109 + var data = try emptyResult(aa, handle, .branch, requested_value, base_oid); │ │110 data.no_commits = true; │ │111 return data; │ │112 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │113 │ │137 - var moment = repo.core.latestMoment() catch return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, content, base_oid);│ │114 + var moment = repo.core.latestMoment() catch return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, base_oid); │ │115 const state = rp.Repo(repo_kind, repo_opts).State(.read_only){ .core = &repo.core, .extra = .{ .moment = &moment } }; │ │116 │ │117 // resolve annotated tags once, independently of the page's starting commit. │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │118 { │ │119 var tip = obj.Object(repo_kind, repo_opts).initCommit(state, io, gpa, &resolved.oid) catch {│ │120 if (query != null) return error.NotFound; │ │144 - return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, content, base_oid); │ │121 + return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, base_oid); │ │122 }; │ │123 defer tip.deinit(); │ │124 resolved.oid = tip.oid; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │125 } │ │126 │ │150 - // collect this page's commit metadata, plus a peek at the one after it (its │ │151 - // oid is the next page's start). the diff for each is rendered afterward, so│ │152 - // the log iterator is closed before opening per-commit diff iterators. │ │127 + // collect this page's commits, plus a peek at the one after it (its oid is │ │128 + // the next page's start). │ │129 var buf: [page_size]Commit = undefined; │ │154 - var oids: [page_size][hex_len]u8 = undefined; │ │130 var count: usize = 0; │ │131 var next_start: ?[]const u8 = null; │ │132 var search_available = false; │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │170 } │ │171 var commit_object = try obj.Object(.xit, repo_opts).initCommit(state, io, gpa, &oid); │ │172 defer commit_object.deinit(); │ │198 - @memcpy(&oids[count], &oid); │ │199 - buf[count] = try commitEntry(repo_kind, repo_opts, arena, repo, io, gpa, admin_moment, &commit_object, root_message and count == 0);│ │173 + buf[count] = try commitEntry(repo_kind, repo_opts, arena, repo, io, gpa, admin_moment, &commit_object, message and count == 0); │ │174 count += 1; │ │175 } │ │176 searched = true; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │182 var start_oid = resolved.oid; │ │183 if (from.len != 0) @memcpy(&start_oid, from); │ │184 │ │211 - var iter = repo.log(io, gpa, .{ .start_oids = &.{start_oid}, .first_parent = true }) catch return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, content, base_oid);│ │185 + var iter = repo.log(io, gpa, .{ .start_oids = &.{start_oid}, .first_parent = true }) catch return emptyResult(aa, handle, resolved.ref_or_oid, resolved.value, base_oid); │ │186 defer iter.deinit(); │ │187 while (try iter.next(gpa)) |commit_object| { │ │188 defer commit_object.deinit(); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │192 next_start = try aa.dupe(u8, &commit_object.oid); │ │193 break; │ │194 } │ │221 - @memcpy(&oids[count], &commit_object.oid); │ │222 - buf[count] = try commitEntry(repo_kind, repo_opts, arena, repo, io, gpa, admin_moment, commit_object, root_message and count == 0); │ │195 + buf[count] = try commitEntry(repo_kind, repo_opts, arena, repo, io, gpa, admin_moment, commit_object, message and count == 0); │ │196 count += 1; │ │224 - } │ │225 - } │ │226 - │ │227 - // render each commit's diff (best effort: a failed diff leaves it empty). │ │228 - // the diff machinery isn't wasm-clean and the wasm client never runs it (it │ │229 - // renders from the snapshot), so gate it out of the wasm build. │ │230 - if (!builtin.cpu.arch.isWasm()) { │ │231 - for (buf[0..count], oids[0..count], 0..) |*commit, oid, i| { │ │232 - if (root_message and i == 0) continue; │ │233 - // the walk root shows the window the url asks for and its filter; │ │234 - // the rest show their first window, unfiltered. │ │235 - const window_start = if (i == 0) root_start else 0; │ │236 - commit.window = renderCommitDiff(repo_kind, repo_opts, io, gpa, aa, repo, oid, window_start, if (i == 0) root_path else "") catch .{ .start = window_start };│ │197 } │ │198 } │ │199 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │211 } else null, │ │212 .commits = try aa.dupe(Commit, buf[0..count]),│ │213 .next_start = next_start, │ │254 - .content = try pageContent(aa, content), │ │214 + .message = message, │ │215 .search = query, │ │216 .search_available = search_available, │ │217 .default_branch = default_branch, │ ╰───────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │218 }; │ │219 } │ │220 │ │261 -// one commit's row: its message, author and stats. the diff window is rendered│ │262 -// afterward, once the log iterator is closed. │ │221 +// one commit's row: its message, author and stats. │ │222 fn commitEntry( │ │223 comptime repo_kind: rp.RepoKind, │ │224 comptime repo_opts: rp.RepoOpts(repo_kind), │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯