╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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 { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1011 "+refs/heads/master:refs/heads/master", │ │1012 }; │ │1013 │ │1108 - const ssh_cmd_maybe: ?[]const u8 = if (is_ssh) blk: { │ │1109 - const known_hosts_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "known_hosts" }); │ │1110 - defer allocator.free(known_hosts_path); │ │1111 - │ │1112 - const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); │ │1113 - defer allocator.free(priv_key_path); │ │1114 - │ │1115 - break :blk try std.fmt.allocPrint(allocator, "ssh -o UserKnownHostsFile=\"{s}\" -o IdentityFile=\"{s}\"", .{ known_hosts_path, priv_key_path });│ │1116 - } else null; │ │1014 + const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name); │ │1015 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); │ │1016 │ │1017 try client_repo.fetch( │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1061 const cwd_path = try std.process.currentPathAlloc(io, allocator); │ │1062 defer allocator.free(cwd_path); │ │1063 │ │1166 - const server_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "repos", "server" }); │ │1064 + // register the repo under admin and locate its on-disk directory │ │1065 + const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; │ │1066 defer allocator.free(server_path); │ │1067 │ │1068 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path });│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1069 defer server_repo.deinit(io, allocator); │ │1070 │ │1071 // add config │ │1173 - switch (transport_def) { │ │1174 - .file => try server_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "true" }), │ │1175 - .wire => { │ │1176 - try server_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "false" }); │ │1177 - try server_repo.addConfig(io, allocator, .{ .name = "receive.denycurrentbranch", .value = "updateinstead" });│ │1178 - }, │ │1179 - } │ │1072 + try server_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "false" }); │ │1073 + try server_repo.addConfig(io, allocator, .{ .name = "receive.denycurrentbranch", .value = "updateinstead" }); │ │1074 try server_repo.addConfig(io, allocator, .{ .name = "http.receivepack", .value = "true" }); │ │1075 │ │1076 // export server repo │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯