╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1 const std = @import("std"); 2 const evt = @import("../event.zig"); 3 const ui = @import("../ui.zig"); 4 const Commits = @import("../ui/Repo/Commits.zig"); 5 const Events = @import("../ui/Repo/Events.zig"); 6 const xit = @import("xit"); 7 8 test "preloaded thread forms receive typing after switching tabs" { 9 const allocator = std.testing.allocator; 10 var arena = std.heap.ArenaAllocator.init(allocator); 11 defer arena.deinit(); 12 var session = ui.Session{ .arena = &arena, .page_arena = &arena, .is_terminal = true, .data = .{ .host_kind = .local } }; 13 session.data.current_page = ui.RoutablePage.repoIssuesRoute("", .open, "", "") orelse return error.BadRoute; 14 const data = try ui.Repo.Issues.emptyResult(arena.allocator(), "", "", "", "", 0, "", .open); 15 var root = ui.Widget{ .repo_issues = try ui.Repo.Issues.View.init(allocator, &data, &session) }; 16 defer root.deinit(allocator); 17 const focus = root.getFocus(); 18 const constraint = xit.xitui.layout.Constraint{ 19 .min_size = .{ .width = null, .height = null }, 20 .max_size = .{ .width = 100, .height = 40 }, 21 }; 22 try root.build(allocator, constraint, focus); 23 24 // switch to the preloaded new tab without recreating the page 25 for ([_]xit.xitui.input.Key{ .arrow_right, .arrow_right, .arrow_right, .arrow_down }) |key| { 26 try ui.inputKey(allocator, &root, key, &session); 27 try root.build(allocator, constraint, focus); 28 } 29 for ([_][]const u8{ "title", "tags", "description" }) |name| { 30 const input = session.text_inputs.get(focus.grandchild_id orelse return error.NoFocus) orelse return error.MissingInput; 31 try std.testing.expectEqualStrings(name, input.options.name); 32 try ui.inputKey(allocator, &root, .{ .codepoint = 'x' }, &session); 33 try root.build(allocator, constraint, focus); 34 const value = try input.text(allocator); 35 defer allocator.free(value); 36 try std.testing.expectEqualStrings("x", value); 37 try ui.inputKey(allocator, &root, .tab, &session); 38 try root.build(allocator, constraint, focus); 39 } 40 } 41 42 test "web controls omit hidden inputs but retain off-screen inputs" { 43 const wgt = xit.xitui.widget; 44 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); 45 defer arena.deinit(); 46 const allocator = arena.allocator(); 47 var session = ui.Session{ .arena = &arena, .page_arena = &arena, .is_terminal = false }; 48 var root = ui.Widget{ .box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }) }; 49 defer root.deinit(allocator); 50 var scroll = try wgt.Scroll(ui.Widget).init(allocator, .{ .box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }) }, .{ .web_native = true }); 51 for ([_][]const u8{ "visible", "hidden", "offscreen" }, 0..) |name, i| { 52 var input = try wgt.TextInput.init(allocator, .{ .name = name, .render_content = false }); 53 input.getFocus().mode = .all; 54 try scroll.child.box.children.put(allocator, input.getFocus().id, .{ 55 .widget = .{ .text_input = input }, 56 .rect = null, 57 .min_size = .{ .width = 20, .height = 3 }, 58 .hidden = i == 1, 59 }); 60 } 61 for (scroll.child.box.children.values()) |*child| { 62 const input = &child.widget.text_input; 63 try session.text_inputs.put(allocator, input.getFocus().id, input); 64 } 65 try root.box.children.put(allocator, scroll.getFocus().id, .{ .widget = .{ .scroll = scroll }, .rect = null, .min_size = null }); 66 const focus = root.getFocus(); 67 try root.build(allocator, .{ .min_size = .{ .width = null, .height = null }, .max_size = .{ .width = 30, .height = 3 } }, focus); 68 69 const children = &root.box.children.values()[0].widget.scroll.child.box.children; 70 const offscreen = children.values()[2].rect orelse return error.MissingRect; 71 try std.testing.expect(offscreen.y >= 3); 72 const html = try @import("../web.zig").generateHtml(allocator, &root, &session); 73 try std.testing.expect(std.mem.indexOf(u8, html, "name=\"visible\"") != null); 74 try std.testing.expect(std.mem.indexOf(u8, html, "name=\"hidden\"") == null); 75 try std.testing.expect(std.mem.indexOf(u8, html, "name=\"offscreen\"") != null); 76 } 77 78 test "diff windows span the net changes across commits" { 79 const io = std.testing.io; 80 const allocator = std.testing.allocator; 81 const Diff = Commits.Diff; 82 const opts: xit.repo.RepoOpts(.xit) = .{ .is_test = true }; 83 var temp = std.testing.tmpDir(.{}); 84 defer temp.cleanup(); 85 const path = try temp.dir.realPathFileAlloc(io, ".", allocator); 86 defer allocator.free(path); 87 var repo = try xit.repo.Repo(.xit, opts).init(io, allocator, .{ .path = path }); 88 defer repo.deinit(io, allocator); 89 var arena = std.heap.ArenaAllocator.init(allocator); 90 defer arena.deinit(); 91 92 // the shared base is absent from the diff 93 { 94 const file = try repo.core.work_dir.createFile(io, "shared.txt", .{}); 95 defer file.close(io); 96 try file.writeStreamingAll(io, "shared\n"); 97 } 98 try repo.add(io, allocator, &.{"shared.txt"}); 99 const base = try repo.commit(io, allocator, .{ .message = "base" }); 100 101 // changes from earlier commits must survive into the combined diff 102 var head = base; 103 for (0..Diff.page_size + 1) |i| { 104 var name_buf: [32]u8 = undefined; 105 const name = try std.fmt.bufPrint(&name_buf, "file-{d:0>2}.txt", .{i}); 106 { 107 const file = try repo.core.work_dir.createFile(io, name, .{}); 108 defer file.close(io); 109 try file.writeStreamingAll(io, "added\n"); 110 } 111 try repo.add(io, allocator, &.{name}); 112 head = try repo.commit(io, allocator, .{ .message = "add file" }); 113 } 114 const first = try Diff.render(.xit, opts, io, allocator, arena.allocator(), &repo, &base, head, 0, ""); 115 try std.testing.expectEqual(Diff.page_size, first.hunks.len); 116 try std.testing.expect(first.start == 0 and first.has_more); 117 try std.testing.expectEqualStrings("file-00.txt", first.hunks[0].path orelse return error.MissingPath); 118 const last = try Diff.render(.xit, opts, io, allocator, arena.allocator(), &repo, &base, head, Diff.page_size, ""); 119 try std.testing.expectEqual(1, last.hunks.len); 120 try std.testing.expect(last.start > 0 and !last.has_more); 121 try std.testing.expectEqualStrings("file-10.txt", last.hunks[0].path orelse return error.MissingPath); 122 const filtered = try Diff.render(.xit, opts, io, allocator, arena.allocator(), &repo, &base, head, 0, "file-00.txt"); 123 try std.testing.expectEqual(1, filtered.hunks.len); 124 try std.testing.expect(!filtered.has_more); 125 126 // the standalone pane links to the next fork diff window in both clients 127 const id = "11111111111111111111111111111111"; 128 const data = Diff{ .route = .{ .fork = .{ .identity = "alice/project", .id = id } }, .window = first }; 129 for ([_]bool{ true, false }) |terminal| { 130 var session = ui.Session{ .arena = &arena, .page_arena = &arena, .is_terminal = terminal }; 131 session.data.current_page = ui.RoutablePage.forkDiffRoute("alice/project", id, 0, "") orelse return error.BadRoute; 132 var view = try Diff.View.init(allocator, &data, &session); 133 defer view.deinit(allocator); 134 const focus = view.getFocus(); 135 try view.build(allocator, .{ .min_size = .{ .width = null, .height = null }, .max_size = .{ .width = 100, .height = 30 } }, focus); 136 const box = &view.scroll.child.box; 137 try std.testing.expectEqual(first.hunks.len * 2 + 1, box.children.count()); 138 const file = ui.crossPageLink(focus, box.children.keys()[0], session.data) orelse return error.MissingFileLink; 139 try std.testing.expectEqualStrings("file-00.txt", file.fork_diff.path.slice()); 140 const next = ui.crossPageLink(focus, box.children.keys()[box.children.count() - 1], session.data) orelse return error.MissingLink; 141 try std.testing.expectEqual(Diff.page_size, next.fork_diff.start); 142 } 143 } 144 145 // the "next" row at the bottom of the commits list must be recognized as a 146 // cross-page link (so a click navigates), exactly like the diff pane's "next". 147 test "commits list next row is a cross-page link" { 148 const allocator = std.testing.allocator; 149 150 var arena = std.heap.ArenaAllocator.init(allocator); 151 defer arena.deinit(); 152 const identity = "alice/ziglings"; 153 const oid0 = "1111111111111111111111111111111111111111"; 154 const next_oid = "2222222222222222222222222222222222222222"; 155 const base_oid = "3333333333333333333333333333333333333333"; 156 157 const data = Commits{ 158 .location = .{ .repo = identity }, 159 .ref_or_oid = .object, 160 .ref_or_oid_value = oid0, 161 .base_oid = base_oid, 162 .commits = &.{ 163 .{ .oid = oid0, .date = "2024-01-01", .message = "first", .window = .{} }, 164 }, 165 .next_start = next_oid, 166 .header = try Commits.Header.init(arena.allocator(), .object, oid0), 167 }; 168 169 var session = ui.Session{ .arena = &arena, .page_arena = &arena, .is_terminal = true }; 170 session.data.current_page = ui.RoutablePage.repoCommitsRoute(identity, .object, oid0, 0, "", base_oid).?; 171 172 var view = try Commits.View.init(allocator, &data, &session); 173 defer view.deinit(allocator); 174 175 const root_focus = view.getFocus(); 176 try view.build(allocator, .{ 177 .min_size = .{ .width = null, .height = null }, 178 .max_size = .{ .width = 120, .height = 60 }, 179 }, root_focus); 180 181 // the "next" row is the last child of the list box: the view's outer box 182 // holds the sub-header then the list/diff split, whose first child is the 183 // list scroll. 184 const content = &view.box.children.values()[1].widget.box; 185 const lb = &content.children.values()[0].widget.scroll.child.box; 186 const next_id = lb.children.keys()[lb.children.count() - 1]; 187 188 const route = ui.crossPageLink(root_focus, next_id, session.data); 189 try std.testing.expect(route != null); 190 try std.testing.expectEqualStrings(base_oid, route.?.repo_commits.base_oid.slice()); 191 } 192 193 // a ref name with a '/' is url-encoded in the route, so it survives the 194 // '/'-delimited url round-trip as a single segment (kind + value) rather than 195 // being mis-parsed as extra path. 196 test "encoded ref name survives the commits url round-trip" { 197 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); 198 defer arena.deinit(); 199 const RP = ui.RoutablePage; 200 const base_oid = "3333333333333333333333333333333333333333"; 201 202 // the route layer holds the value already url-encoded ("feature%2Ffoo"). 203 const route = RP.repoCommitsRoute("alice/ziglings", .branch, "feature%2Ffoo", 0, "", base_oid).?; 204 const url = try route.toUrl(&arena); 205 try std.testing.expectEqualStrings("/repo/alice/ziglings/commits/branch:feature%2Ffoo/base:" ++ base_oid, url); 206 207 // parsing it back yields the same route, and the ref splits out intact. 208 const parsed = RP.fromUrl(url); 209 try std.testing.expect(parsed != null); 210 const parsed_route = parsed.?.repo_commits; 211 try std.testing.expectEqual(RP.RefOrOid.branch, parsed_route.ref_or_oid.?); 212 try std.testing.expectEqualStrings("feature%2Ffoo", parsed_route.value.slice()); 213 try std.testing.expectEqualStrings(base_oid, parsed_route.base_oid.slice()); 214 const unfiltered = RP.repoCommitsRoute("alice/ziglings", .branch, "feature%2Ffoo", 0, "", "").?; 215 try std.testing.expect(!RP.eql(route, unfiltered)); 216 } 217 218 test "commit pages stop at the base without excluding other ancestors" { 219 try testCommitBase(.git); 220 try testCommitBase(.xit); 221 } 222 223 fn testCommitBase(comptime kind: xit.repo.RepoKind) !void { 224 const io = std.testing.io; 225 const allocator = std.testing.allocator; 226 const opts: xit.repo.RepoOpts(kind) = .{ .is_test = true }; 227 var temp = std.testing.tmpDir(.{}); 228 defer temp.cleanup(); 229 const path = try temp.dir.realPathFileAlloc(io, ".", allocator); 230 defer allocator.free(path); 231 var repo = try xit.repo.Repo(kind, opts).init(io, allocator, .{ .path = path }); 232 defer repo.deinit(io, allocator); 233 var arena = std.heap.ArenaAllocator.init(allocator); 234 defer arena.deinit(); 235 const location = ui.RoutablePage.RepoLocation{ .repo = "" }; 236 const content = ui.RoutablePage.RepoCommitsRoute.Content{ .diff = .{} }; 237 const branch = xit.ref.Ref{ .kind = .head, .name = "master" }; 238 239 // one more commit than fits on the first page 240 const base = try repo.commitAtRef(io, allocator, .{ .message = "base" }, null, branch); 241 var tip = base; 242 var previous = base; 243 for (0..21) |_| { 244 previous = tip; 245 tip = try repo.commitAtRef(io, allocator, .{ .message = "next" }, null, branch); 246 } 247 const first = try Commits.init(kind, opts, &arena, &repo, io, allocator, null, location, .object, &tip, content, &base); 248 try std.testing.expectEqual(20, first.commits.len); 249 try std.testing.expectEqual(@as(?u64, if (kind == .xit) 21 else null), first.commit_count); 250 const last = try Commits.init(kind, opts, &arena, &repo, io, allocator, null, location, .object, first.next_start orelse return error.MissingNext, content, &base); 251 try std.testing.expectEqual(1, last.commits.len); 252 try std.testing.expectEqual(null, last.next_start); 253 254 // the base at a page boundary must not create an empty next page 255 const full = try Commits.init(kind, opts, &arena, &repo, io, allocator, null, location, .object, &previous, content, &base); 256 try std.testing.expectEqual(20, full.commits.len); 257 try std.testing.expectEqual(null, full.next_start); 258 _ = try repo.addTag(io, allocator, .{ .name = "tip", .message = "annotated" }); 259 const sources = [_]struct { ref: ui.RoutablePage.RefOrOid, value: []const u8 }{ 260 .{ .ref = .object, .value = &tip }, 261 .{ .ref = .branch, .value = branch.name }, 262 .{ .ref = .tag, .value = "tip" }, 263 }; 264 for (sources) |source| { 265 const empty = try Commits.init(kind, opts, &arena, &repo, io, allocator, null, location, source.ref, source.value, content, &tip); 266 try std.testing.expectEqual(0, empty.commits.len); 267 try std.testing.expectEqual(@as(?u64, if (kind == .xit) 0 else null), empty.commit_count); 268 } 269 270 // an off-chain stopping point must not hide its parent on this chain 271 const other = try repo.commitAtRef(io, allocator, .{ .message = "other", .parent_oids = &.{base} }, null, .{ .kind = .head, .name = "other" }); 272 const off_chain = try Commits.init(kind, opts, &arena, &repo, io, allocator, null, location, .object, last.commits[0].oid, content, &other); 273 try std.testing.expectEqual(2, off_chain.commits.len); 274 try std.testing.expectEqualStrings(&base, off_chain.commits[1].oid); 275 try std.testing.expectEqual(null, off_chain.commit_count); 276 } 277 278 test "sync creates missing event branches and preserves head" { 279 const io = std.testing.io; 280 const allocator = std.testing.allocator; 281 282 var temp = std.testing.tmpDir(.{}); 283 defer temp.cleanup(); 284 const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); 285 defer allocator.free(temp_path); 286 287 const local_path = try std.fs.path.join(allocator, &.{ temp_path, "local" }); 288 defer allocator.free(local_path); 289 const remote_path = try std.fs.path.join(allocator, &.{ temp_path, "remote" }); 290 defer allocator.free(remote_path); 291 292 const Repo = xit.repo.Repo(.git, .{}); 293 const RemoteRepo = xit.repo.Repo(.git, .{}); 294 { 295 var remote = try RemoteRepo.init(io, allocator, .{ .path = remote_path }); 296 remote.deinit(io, allocator); 297 } 298 { 299 var local = try Repo.init(io, allocator, .{ .path = local_path }); 300 defer local.deinit(io, allocator); 301 try local.addConfig(io, allocator, .{ .name = "user.name", .value = "user" }); 302 try local.addConfig(io, allocator, .{ .name = "user.email", .value = "user@haxy" }); 303 { 304 const file = try local.core.work_dir.createFile(io, "keep.txt", .{}); 305 defer file.close(io); 306 try file.writeStreamingAll(io, "keep"); 307 } 308 try local.add(io, allocator, &.{"keep.txt"}); 309 _ = try local.commit(io, allocator, .{ .message = "master" }); 310 try local.addRemote(io, allocator, .{ .name = "origin", .value = remote_path }); 311 312 const id = [_]u8{1} ** evt.event_id_size; 313 try evt.consume(.local, .repo, .git, .{}, io, allocator, &local, evt.events_ref, &.{.{ 314 .id = std.fmt.bytesToHex(id, .lower), 315 .author = .{ .name = "haxy", .email = "user@haxy" }, 316 .event = .{ .issue = .{ .title = "sync", .description = "", .tags = "" } }, 317 }}); 318 } 319 320 try std.testing.expectEqual(null, try Events.sync(io, allocator, .{ .path = local_path, .repo_kind = .git })); 321 { 322 var local = try Repo.open(io, allocator, .{ .path = local_path }); 323 defer local.deinit(io, allocator); 324 const id = [_]u8{2} ** evt.event_id_size; 325 try evt.consume(.local, .repo, .git, .{}, io, allocator, &local, evt.events_ref, &.{.{ 326 .id = std.fmt.bytesToHex(id, .lower), 327 .author = .{ .name = "haxy", .email = "user@haxy" }, 328 .event = .{ .issue = .{ .title = "local", .description = "", .tags = "" } }, 329 }}); 330 } 331 { 332 var remote = try RemoteRepo.open(io, allocator, .{ .path = remote_path }); 333 defer remote.deinit(io, allocator); 334 const id = [_]u8{3} ** evt.event_id_size; 335 try evt.consume(.local, .repo, .git, .{}, io, allocator, &remote, evt.events_ref, &.{.{ 336 .id = std.fmt.bytesToHex(id, .lower), 337 .author = .{ .name = "haxy", .email = "user@haxy" }, 338 .event = .{ .issue = .{ .title = "remote", .description = "", .tags = "" } }, 339 }}); 340 } 341 try std.testing.expectEqual(null, try Events.sync(io, allocator, .{ .path = local_path, .repo_kind = .git })); 342 { 343 var local = try Repo.open(io, allocator, .{ .path = local_path }); 344 defer local.deinit(io, allocator); 345 try local.removeBranch(io, .{ .name = evt.events_ref.name }); 346 try evt.consume(.local, .repo, .git, .{}, io, allocator, &local, evt.events_ref, &.{}); 347 } 348 try std.testing.expectEqual(null, try Events.sync(io, allocator, .{ .path = local_path, .repo_kind = .git })); 349 350 var local = try Repo.open(io, allocator, .{ .path = local_path }); 351 defer local.deinit(io, allocator); 352 var head_buffer: [xit.ref.MAX_REF_CONTENT_SIZE]u8 = undefined; 353 const head = try local.head(io, &head_buffer); 354 switch (head) { 355 .ref => |ref| try std.testing.expectEqualStrings("master", ref.name), 356 .oid => return error.TestExpectedEqual, 357 } 358 const kept = try local.core.work_dir.openFile(io, "keep.txt", .{}); 359 kept.close(io); 360 const local_tip = (try local.readRef(io, evt.events_ref)) orelse return error.TestExpectedEqual; 361 362 var remote = try RemoteRepo.open(io, allocator, .{ .path = remote_path }); 363 defer remote.deinit(io, allocator); 364 const remote_tip = (try remote.readRef(io, evt.events_ref)) orelse return error.TestExpectedEqual; 365 try std.testing.expectEqualStrings(&local_tip, &remote_tip); 366 367 var start_oids = [_][local_tip.len]u8{local_tip}; 368 var commit_iter = try local.log(io, allocator, .{ .start_oids = &start_oids }); 369 defer commit_iter.deinit(); 370 var merge_commit = (try commit_iter.next(allocator)) orelse return error.TestExpectedEqual; 371 defer merge_commit.deinit(); 372 const parent_oids = merge_commit.content.commit.metadata.parent_oids orelse return error.TestExpectedEqual; 373 try std.testing.expectEqual(2, parent_oids.len); 374 375 var arena = std.heap.ArenaAllocator.init(allocator); 376 defer arena.deinit(); 377 const status = try Events.Header.local(.git, .{}, arena.allocator(), &local, io, null); 378 try std.testing.expectEqualStrings("nothing to sync", status.sync_status orelse return error.TestExpectedEqual); 379 } 380