╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────╮ │ 7 const pch = hx.pch; │ │ 8 const rp = xit.repo; │ │ 9 const rf = xit.ref; │ │10 -const work = xit.workdir;│ │10 const hash = xit.hash; │ │11 const net = xit.net; │ │12 │ ╰─────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │170 const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │171 defer allocator.free(server_path); │ │172 │ │174 - var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path }); │ │173 + var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .bare = true, .path = server_path });│ │174 defer server_repo.deinit(io, allocator); │ │175 │ │176 // make a commit │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │178 - const commit1 = blk: { │ │179 - const hello_txt = try server_repo.core.work_dir.createFile(io, "hello.txt", .{ .truncate = true }); │ │180 - defer hello_txt.close(io); │ │181 - try hello_txt.writeStreamingAll(io, "hello, world!"); │ │182 - try server_repo.add(io, allocator, &.{"hello.txt"}); │ │183 - break :blk try server_repo.commit(io, allocator, .{ .message = "let there be light" }); │ │184 - }; │ │177 + const commit1 = try commitServer(&server_repo, io, allocator, .{ .files = &.{.{ .path = "hello.txt", .content = "hello, world!" }} }, .{ .message = "let there be light" });│ │178 │ │179 // export server repo │ │180 { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │246 } │ │247 │ │248 // make another commit │ │256 - const commit2 = blk: { │ │257 - const goodbye_txt = try server_repo.core.work_dir.createFile(io, "goodbye.txt", .{ .truncate = true }); │ │258 - defer goodbye_txt.close(io); │ │259 - try goodbye_txt.writeStreamingAll(io, "goodbye, world!"); │ │260 - try server_repo.add(io, allocator, &.{"goodbye.txt"}); │ │261 - break :blk try server_repo.commit(io, allocator, .{ .message = "goodbye" }); │ │262 - }; │ │249 + const commit2 = try commitServer(&server_repo, io, allocator, .{ .files = &.{.{ .path = "goodbye.txt", .content = "goodbye, world!" }} }, .{ .message = "goodbye" });│ │250 │ │251 try client_repo.fetch( │ │252 io, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │298 const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │299 defer allocator.free(server_path); │ │300 │ │314 - var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path }); │ │301 + var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .bare = true, .path = server_path });│ │302 defer server_repo.deinit(io, allocator); │ │303 │ │304 // add config │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │318 - try server_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "false" }); │ │319 - try server_repo.addConfig(io, allocator, .{ .name = "receive.denycurrentbranch", .value = "updateinstead" });│ │305 try server_repo.addConfig(io, allocator, .{ .name = "http.receivepack", .value = "true" }); │ │306 │ │307 // export server repo │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │371 } │ │372 │ │373 // make a commit on the server │ │389 - { │ │390 - const hello_txt = try server_repo.core.work_dir.createFile(io, "hello.txt", .{ .truncate = true }); │ │391 - defer hello_txt.close(io); │ │392 - try hello_txt.writeStreamingAll(io, "hello, world from the server!"); │ │393 - try server_repo.add(io, allocator, &.{"hello.txt"}); │ │394 - _ = try server_repo.commit(io, allocator, .{ .message = "new commit from the server" }); │ │395 - } │ │374 + _ = try commitServer(&server_repo, io, allocator, .{ .files = &.{.{ .path = "hello.txt", .content = "hello, world from the server!" }} }, .{ .message = "new commit from the server" });│ │375 │ │376 // make another commit │ │377 const commit2 = blk: { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │395 )); │ │396 │ │397 // make a commit on the server with no parents, thus creating an incompatible git history │ │419 - { │ │420 - const hello_txt = try server_repo.core.work_dir.createFile(io, "hello.txt", .{ .truncate = true }); │ │421 - defer hello_txt.close(io); │ │422 - try hello_txt.writeStreamingAll(io, "hello, world from the server again!"); │ │423 - try server_repo.add(io, allocator, &.{"hello.txt"}); │ │424 - _ = try server_repo.commit(io, allocator, .{ .message = "new git history on the server", .parent_oids = &.{} }); │ │425 - } │ │398 + _ = try commitServer(&server_repo, io, allocator, .{ .files = &.{.{ .path = "hello.txt", .content = "hello, world from the server again!" }} }, .{ .message = "new git history on the server", .parent_oids = &.{} });│ │399 │ │400 // can't push because commit doesn't exist locally │ │401 try std.testing.expectError(error.RemoteRefContainsCommitsNotFoundLocally, client_repo.push( │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │517 const target_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "target", true)).?; │ │518 defer allocator.free(target_path); │ │519 { │ │547 - var target_repo = try rp.Repo(.xit, .{}).init(io, allocator, .{ .path = target_path }); │ │520 + var target_repo = try rp.Repo(.xit, .{}).init(io, allocator, .{ .bare = true, .path = target_path }); │ │521 defer target_repo.deinit(io, allocator); │ │549 - const file = try target_repo.core.work_dir.createFile(io, "main.txt", .{ .truncate = true }); │ │550 - defer file.close(io); │ │551 - try file.writeStreamingAll(io, "base contents\n"); │ │552 - try target_repo.add(io, allocator, &.{"main.txt"}); │ │553 - _ = try target_repo.commit(io, allocator, .{ .author = "admin <admin@example.test>", .message = "initial code" }); │ │554 - try target_repo.addConfig(io, allocator, .{ .name = "receive.denycurrentbranch", .value = "updateinstead" }); │ │522 + _ = try commitServer(&target_repo, io, allocator, .{ .files = &.{.{ .path = "main.txt", .content = "base contents\n" }} }, .{ .author = "admin <admin@example.test>", .message = "initial code" });│ │523 } │ │524 │ │525 const other_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "other", true)).?; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │571 client_path, │ │572 client_path, │ │573 null, │ │606 - .{ .wire = .{ .ssh = .{ .command = ssh_cmd } } }, │ │574 + .{ .transport = .{ .wire = .{ .ssh = .{ .command = ssh_cmd } } } },│ │575 ); │ │576 defer client.deinit(io, allocator); │ │577 │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯