╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │544 │ │545 _ = try client_repo.addTag(io, allocator, .{ .name = "1.0.0", .message = "hi" }); │ │546 │ │547 + // the repo is not pre-registered; the push should mint the repo event under │ │548 + // admin and create the repo on disk │ │549 { │ │597 - if (.windows == builtin.os.tag) { │ │598 - std.mem.replaceScalar(u8, server_path, '\\', '/'); │ │599 - } │ │600 - const separator = if (server_path[0] == '/') "" else "/"; │ │601 - │ │602 - const remote_url = switch (transport_def) { │ │603 - .file => unreachable, │ │604 - .wire => |wire_kind| switch (wire_kind) { │ │605 - .http => try std.fmt.allocPrint(allocator, "http://localhost:{}/server", .{http_port}), │ │606 - .raw => unreachable, │ │607 - .ssh => try std.fmt.allocPrint(allocator, "ssh://localhost:{}{s}{s}", .{ ssh_port, separator, server_path }),│ │608 - }, │ │609 - }; │ │550 + const remote_url = try remoteUrl(transport_def, allocator, "testrepo"); │ │551 defer allocator.free(remote_url); │ │552 │ │553 try client_repo.addRemote(io, allocator, .{ .name = "origin", .value = remote_url }); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │558 .file => false, │ │559 .wire => |wire_kind| .ssh == wire_kind, │ │560 }; │ │620 - // haxy generates a fresh host key on every run, so don't try to record │ │621 - // it. accept the unknown host and skip writing to known_hosts. the key │ │622 - // identity flag picks the ed25519 key created in runServer. │ │623 - const ssh_cmd_maybe: ?[]const u8 = if (is_ssh) blk: { │ │624 - const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │625 - defer allocator.free(priv_key_path); │ │626 - │ │627 - break :blk try std.fmt.allocPrint(allocator, "ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=\"{s}\"", .{priv_key_path});│ │628 - } else null; │ │561 + const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name); │ │562 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); │ │563 │ │564 try client_repo.push( │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │571 .command = ssh_cmd_maybe, │ │572 } } }, │ │573 ); │ │574 + │ │575 + // the push registered admin/server; resolve its on-disk directory │ │576 + const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", false)).?; │ │577 + defer allocator.free(server_path); │ │578 │ │579 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).open(io, allocator, .{ .path = server_path });│ │580 defer server_repo.deinit(io, allocator); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │615 const temp_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name }); │ │616 defer allocator.free(temp_path); │ │617 │ │681 - const server_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "repos", "server" });│ │618 + // register the repo under admin and locate its on-disk directory │ │619 + const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │620 defer allocator.free(server_path); │ │621 │ │622 // init server repo with default branch name as main │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │661 defer allocator.free(client_path); │ │662 │ │663 // get remote url │ │726 - const remote_url = blk: { │ │727 - if (.windows == builtin.os.tag) { │ │728 - std.mem.replaceScalar(u8, server_path, '\\', '/'); │ │729 - } │ │730 - const separator = if (server_path[0] == '/') "" else "/"; │ │731 - │ │732 - break :blk switch (transport_def) { │ │733 - //.file => try std.fmt.allocPrint(allocator, "file://{s}{s}", .{ separator, server_path }), │ │734 - .file => try std.fmt.allocPrint(allocator, "server", .{}), // relative file paths work too │ │735 - .wire => |wire_kind| switch (wire_kind) { │ │736 - .http => try std.fmt.allocPrint(allocator, "http://localhost:{}/server", .{http_port}), │ │737 - .raw => try std.fmt.allocPrint(allocator, "git://localhost:{}/server", .{http_port}), │ │738 - .ssh => try std.fmt.allocPrint(allocator, "ssh://localhost:{}{s}{s}", .{ ssh_port, separator, server_path }),│ │739 - }, │ │740 - }; │ │741 - }; │ │664 + const remote_url = try remoteUrl(transport_def, allocator, "testrepo"); │ │665 defer allocator.free(remote_url); │ │666 │ │667 const is_ssh = switch (transport_def) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │672 if (shell_out_to_git) { │ │673 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │674 defer allocator.free(priv_key_path); │ │752 - const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{priv_key_path}); │ │675 + const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{ ssh_port, priv_key_path });│ │676 defer allocator.free(ssh_config_arg); │ │677 │ │678 { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │835 goodbye_txt.close(io); │ │836 } │ │837 } else { │ │915 - const ssh_cmd_maybe: ?[]const u8 = if (is_ssh) blk: { │ │916 - const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │917 - defer allocator.free(priv_key_path); │ │918 - │ │919 - break :blk try std.fmt.allocPrint(allocator, "ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=\"{s}\"", .{priv_key_path});│ │920 - } else null; │ │838 + const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name); │ │839 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); │ │840 │ │841 // clone repo │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │889 const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │890 defer allocator.free(cwd_path); │ │891 │ │974 - const server_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "repos", "server" }); │ │892 + // register the repo under admin and locate its on-disk directory │ │893 + const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │894 defer allocator.free(server_path); │ │895 │ │896 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path });│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 933 │ │ 934 // add remote │ │ 935 { │ │1017 - if (.windows == builtin.os.tag) { │ │1018 - std.mem.replaceScalar(u8, server_path, '\\', '/'); │ │1019 - } │ │1020 - const separator = if (server_path[0] == '/') "" else "/"; │ │1021 - │ │1022 - const remote_url = switch (transport_def) { │ │1023 - //.file => try std.fmt.allocPrint(allocator, "file://{s}{s}", .{ separator, server_path }), │ │1024 - .file => try std.fmt.allocPrint(allocator, "../server", .{}), // relative file paths work too │ │1025 - .wire => |wire_kind| switch (wire_kind) { │ │1026 - .http => try std.fmt.allocPrint(allocator, "http://localhost:{}/server", .{http_port}), │ │1027 - .raw => try std.fmt.allocPrint(allocator, "git://localhost:{}/server", .{http_port}), │ │1028 - .ssh => try std.fmt.allocPrint(allocator, "ssh://localhost:{}{s}{s}", .{ ssh_port, separator, server_path }),│ │1029 - }, │ │1030 - }; │ │ 936 + const remote_url = try remoteUrl(transport_def, allocator, "testrepo"); │ │ 937 defer allocator.free(remote_url); │ │ 938 │ │ 939 try client_repo.addRemote(io, allocator, .{ .name = "origin", .value = remote_url }); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 948 if (shell_out_to_git) { │ │ 949 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │ 950 defer allocator.free(priv_key_path); │ │1045 - const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{priv_key_path}); │ │ 951 + const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{ ssh_port, priv_key_path });│ │ 952 defer allocator.free(ssh_config_arg); │ │ 953 │ │ 954 { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯