╭ changed ───────────────╮ │src/test/event/patch.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │13 const repo_opts: rp.RepoOpts(.xit) = .{ .is_test = true }; │ │14 const Repo = rp.Repo(.xit, repo_opts); │ │15 const author = evt.CommitAuthor{ .name = "alice", .email = "alice@example.test" }; │ │16 - │ │17 -test "patch commit counts require a short first-parent path" { │ │18 - const io = std.testing.io; │ │19 - const allocator = std.testing.allocator; │ │20 - var temp = std.testing.tmpDir(.{}); │ │21 - defer temp.cleanup(); │ │22 - const path = try temp.dir.realPathFileAlloc(io, ".", allocator); │ │23 - defer allocator.free(path); │ │24 - var repo = try Repo.init(io, allocator, .{ .path = path }); │ │25 - defer repo.deinit(io, allocator); │ │26 - const branch = rf.Ref{ .kind = .head, .name = "patch" }; │ │27 - │ │28 - // a second-parent base must not produce a misleading depth difference │ │29 - const root = try repo.commitAtRef(io, allocator, .{ .message = "root" }, null, branch); │ │30 - const base = try repo.commitAtRef(io, allocator, .{ .message = "base" }, null, branch); │ │31 - const source = try repo.commitAtRef(io, allocator, .{ .message = "source", .parent_oids = &.{root} }, null, branch); │ │32 - var tip = try repo.commitAtRef(io, allocator, .{ .message = "merge", .parent_oids = &.{ source, base } }, null, branch); │ │33 - var moment = try repo.core.latestMoment(); │ │34 - const state = Repo.State(.read_only){ .core = &repo.core, .extra = .{ .moment = &moment } }; │ │35 - try std.testing.expectEqual(null, try evt.PatchRev.commitCount(.xit, repo_opts, state, io, allocator, &base, &tip)); │ │36 - try std.testing.expectEqual(@as(?u64, 2), try evt.PatchRev.commitCount(.xit, repo_opts, state, io, allocator, &root, &tip)); │ │37 - try std.testing.expectEqual(null, try evt.PatchRev.commitCount(.xit, repo_opts, state, io, allocator, &tip, &root)); │ │38 - try std.testing.expectEqual(null, try evt.PatchRev.commitCount(.xit, repo_opts, state, io, allocator, &base, &source)); │ │39 - │ │40 - // long ranges omit the count instead of walking unbounded history │ │41 - for (2..256) |_| { │ │42 - tip = try repo.commitAtRef(io, allocator, .{ .message = "next" }, null, branch); │ │43 - } │ │44 - moment = try repo.core.latestMoment(); │ │45 - try std.testing.expectEqual(@as(?u64, 256), try evt.PatchRev.commitCount(.xit, repo_opts, state, io, allocator, &root, &tip));│ │46 - tip = try repo.commitAtRef(io, allocator, .{ .message = "next" }, null, branch); │ │47 - moment = try repo.core.latestMoment(); │ │48 - try std.testing.expectEqual(null, try evt.PatchRev.commitCount(.xit, repo_opts, state, io, allocator, &root, &tip)); │ │49 -} │ │16 │ │17 test "branch patch lifecycle" { │ │18 try testBranchPatch(.git, .sha1); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │59 const first = (try evt.readFromRepo(evt.Patch, kind, opts, io, allocator, &arena, &repo, &id)) orelse return error.NotFound; │ │60 const first_revision = first.event.revision orelse return error.NotFound; │ │61 try std.testing.expectEqualStrings(&base, first_revision.source_oid); │ │96 - try std.testing.expectEqual(@as(?u64, if (kind == .xit) 0 else null), first_revision.commit_count); │ │62 try std.testing.expectEqualStrings(&base, &(try repo.readRef(io, .{ .kind = .head, .name = "master" }) orelse return error.NotFound));│ │63 │ │64 // an unchanged refresh does not add events │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 81 const updated = (try evt.readFromRepo(evt.Patch, kind, opts, io, allocator, &arena, &repo, &id)) orelse return error.NotFound;│ │ 82 const revision = updated.event.revision orelse return error.NotFound; │ │ 83 try std.testing.expectEqualStrings(&next, revision.source_oid); │ │119 - try std.testing.expectEqual(@as(?u64, if (kind == .xit) 1 else null), revision.commit_count); │ │ 84 try std.testing.expect(!std.mem.eql(u8, &first_revision.id, &revision.id)); │ │ 85 try std.testing.expectEqualStrings(patch.title, updated.event.title); │ │ 86 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯