╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───────────────╮ │src/test/event/patch.zig│ ╰────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │92 const first = (try evt.Patch.readFromRepo(kind, opts, io, allocator, &arena, &repo, &id)) orelse return error.NotFound; │ │93 const first_revision = first.event.revision orelse return error.NotFound; │ │94 try std.testing.expectEqualStrings(&base, first_revision.source_oid); │ │95 + try std.testing.expectEqual(@as(?u64, if (kind == .xit) 0 else null), first_revision.commit_count); │ │96 try std.testing.expectEqualStrings(&base, &(try repo.readRef(io, .{ .kind = .head, .name = "master" }) orelse return error.NotFound));│ │97 │ │98 // an unchanged refresh does not add events │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │115 const updated = (try evt.Patch.readFromRepo(kind, opts, io, allocator, &arena, &repo, &id)) orelse return error.NotFound;│ │116 const revision = updated.event.revision orelse return error.NotFound; │ │117 try std.testing.expectEqualStrings(&next, revision.source_oid); │ │118 + try std.testing.expectEqual(@as(?u64, if (kind == .xit) 1 else null), revision.commit_count); │ │119 try std.testing.expect(!std.mem.eql(u8, &first_revision.id, &revision.id)); │ │120 try std.testing.expectEqualStrings(patch.title, updated.event.title); │ │121 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │602 const selected = patch.event.revision orelse return error.NotFound; │ │603 try std.testing.expectEqualStrings("master", patch.event.target_branch); │ │604 try std.testing.expectEqualStrings(&source_oid, selected.source_oid); │ │605 + try std.testing.expectEqual(@as(?u64, 1), selected.commit_count); │ │606 first_revision_id = try evt.parseEventId(&selected.id); │ │607 const revision = (try evt.PatchRev.readById(evt.EventDB(hash_kind), hash_kind, moment, &arena, &first_revision_id)) orelse return error.NotFound;│ │608 try std.testing.expectEqualStrings(&source_oid, revision.event.source_oid); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │678 const selected = patch.event.revision orelse return error.NotFound; │ │679 try std.testing.expectEqualStrings(&std.fmt.bytesToHex(second_revision_id, .lower), &selected.id);│ │680 try std.testing.expectEqualStrings(&second_source_oid, selected.source_oid); │ │681 + try std.testing.expectEqual(@as(?u64, 2), selected.commit_count); │ │682 try std.testing.expectEqualStrings("feature", patch.event.target_branch); │ │683 } │ │684 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/ui/Fork.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │57 const fork_moment = try evt.currentMoment(.{}, &fork_repo); │ │58 const retained_patch = (try evt.Patch.readById(evt.EventDB(.sha1), .sha1, fork_moment, arena, &id)) orelse return error.NotFound;│ │59 const fork_oid = (try fork_repo.readRef(io, fork.ref)) orelse return error.NotFound; │ │60 + const newest_revision = try evt.PatchRev.readNewest(evt.EventDB(.sha1), .sha1, fork_moment, arena); │ │61 var commits_base_oid = fork_oid; │ │61 - if (try evt.PatchRev.readNewest(evt.EventDB(.sha1), .sha1, fork_moment, arena)) |revision| { │ │62 + if (newest_revision) |revision| { │ │63 if (revision.record.event.base_oid.len != commits_base_oid.len) return error.NotFound; │ │64 @memcpy(&commits_base_oid, revision.record.event.base_oid); │ │65 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │127 .id = &id_hex, │ │128 } }; │ │129 const files = try Files.init(.xit, .{}, arena, &fork_repo, io, arena.child_allocator, location, requested_ref, requested_value, files_path, files_line); │ │129 - const commits = try Commits.init(.xit, .{}, arena, &fork_repo, io, arena.child_allocator, haxy_moment, location, requested_ref, requested_value, commits_content, commits_base_oid);│ │130 + var commits = try Commits.init(.xit, .{}, arena, &fork_repo, io, arena.child_allocator, haxy_moment, location, requested_ref, requested_value, commits_content, commits_base_oid); │ │131 + commits.commit_count = if (newest_revision) |revision| revision.record.commit_count else 0; │ │132 const diff_start: usize = switch (route) { │ │133 .fork_diff => |d| d.start, │ │134 else => 0, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │153 } │ │154 } │ │155 │ │156 - const commit_count: ?u64 = switch (repo_kind) { │ │157 - .git => null, │ │158 - .xit => blk: { │ │159 - const head_count = repo.commitCount(io, gpa, .{ .oid = &resolved.oid }) catch break :blk null;│ │160 - const base_oid = base_oid_maybe orelse break :blk head_count; │ │161 - const base_count = repo.commitCount(io, gpa, .{ .oid = &base_oid }) catch break :blk null; │ │162 - break :blk if (head_count >= base_count) head_count - base_count else null; │ │163 - }, │ │164 - }; │ │165 - │ │156 return .{ │ │157 .location = try location.dupe(aa), │ │158 .ref_or_oid = resolved.ref_or_oid, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │159 .ref_or_oid_value = resolved.value, │ │170 - .commit_count = commit_count, │ │160 + .commit_count = if (repo_kind == .xit and base_oid_maybe == null) │ │161 + repo.commitCount(io, gpa, .{ .oid = &resolved.oid }) catch null│ │162 + else │ │163 + null, │ │164 .commits = try aa.dupe(Commit, buf[0..count]), │ │165 .next_start = next_start, │ │166 .content = try pageContent(aa, content), │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────────────────────────────────────────────────╮ │157 attachments: []const Attachment.WithId = &.{},│ │158 draft: bool = false, │ │159 revision_oid: []const u8 = "", │ │160 + commit_count: ?u64 = null, │ │161 no_changes: bool = false, │ │162 fork_exists: bool = false, │ │163 mergeability: pch.Mergeability = .{}, │ ╰───────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │257 │ │258 pub fn listRoute(identity: []const u8, status: Status, tag: []const u8, selected: []const u8) ?ui.RoutablePage {│ │259 return ui.RoutablePage.repoPatchesRoute(identity, status, tag, selected); │ │259 -} │ │260 - │ │261 -pub fn forkRoute(identity: []const u8, id: []const u8) ?ui.RoutablePage { │ │262 - return ui.RoutablePage.forkPatchRoute(identity, id); │ │260 } │ │261 │ │262 pub fn draftsRoute(identity: []const u8) ?ui.RoutablePage { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯