╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ net.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1035 } 1036 } 1037 1038 fn testFetchLarge( 1039 comptime repo_kind: rp.RepoKind, 1040 comptime transport_def: net.TransportDefinition, 1041 comptime shell_out_to_git: bool, 1042 comptime port: u16, 1043 io: std.Io, 1044 allocator: std.mem.Allocator, 1045 ) !void { 1046 const temp_dir_name = "temp-testnet-fetch-large"; 1047 1048 // create the temp dir 1049 const cwd = std.Io.Dir.cwd(); 1050 var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); 1051 if (temp_dir_or_err) |*temp_dir| { 1052 temp_dir.close(io); 1053 try cwd.deleteTree(io, temp_dir_name); 1054 } else |_| {} 1055 var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); 1056 defer cwd.deleteTree(io, temp_dir_name) catch {}; 1057 defer temp_dir.close(io); 1058 1059 // init server 1060 var server_process = try runServer(io, allocator, temp_dir_name, port); 1061 defer _ = server_process.kill(io); 1062 1063 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1064 defer allocator.free(cwd_path); 1065 1066 // register the repo under admin and locate its on-disk directory 1067 const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; 1068 defer allocator.free(server_path); 1069 1070 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path }); 1071 defer server_repo.deinit(io, allocator); 1072 1073 var server_dir = try cwd.openDir(io, server_path, .{}); 1074 defer server_dir.close(io); 1075 1076 // copy files from current repo into server dir 1077 for (&[_][]const u8{"src"}) |dir_name| { 1078 var src_repo_dir = try cwd.openDir(io, dir_name, .{ .iterate = true }); 1079 defer src_repo_dir.close(io); 1080 1081 var dest_repo_dir = try server_dir.createDirPathOpen(io, dir_name, .{}); 1082 defer dest_repo_dir.close(io); 1083 1084 try copyDir(io, src_repo_dir, dest_repo_dir); 1085 1086 try server_repo.add(io, allocator, &.{dir_name}); 1087 } 1088 1089 // make a commit 1090 const commit1 = try server_repo.commit(io, allocator, .{ .message = "let there be light" }); 1091 1092 // export server repo 1093 { 1094 const export_file = try server_repo.core.repo_dir.createFile(io, "git-daemon-export-ok", .{}); 1095 defer export_file.close(io); 1096 } 1097 1098 if (shell_out_to_git) { 1099 try server_repo.addConfig(io, allocator, .{ .name = "uploadpack.allowrefinwant", .value = "true" }); 1100 } 1101 1102 const client_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "client" }); 1103 defer allocator.free(client_path); 1104 1105 var client_repo = try rp.Repo(repo_kind, .{ .is_test = true }).init(io, allocator, .{ .path = client_path }); 1106 defer client_repo.deinit(io, allocator); 1107 1108 // add remote 1109 { 1110 const remote_url = try remoteUrl(transport_def, allocator, "testrepo", port); 1111 defer allocator.free(remote_url); 1112 1113 try client_repo.addRemote(io, allocator, .{ .name = "origin", .value = remote_url }); 1114 try client_repo.addConfig(io, allocator, .{ .name = "branch.master.remote", .value = "origin" }); 1115 } 1116 1117 const is_ssh = switch (transport_def) { 1118 .file => false, 1119 .wire => |wire_kind| .ssh == wire_kind, 1120 }; 1121 1122 if (shell_out_to_git) { 1123 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); 1124 defer allocator.free(priv_key_path); 1125 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}", .{ port + 1, priv_key_path }); 1126 defer allocator.free(ssh_config_arg); 1127 1128 { 1129 var process = try std.process.spawn(io, .{ 1130 .argv = if (is_ssh) 1131 &.{ "git", "-c", ssh_config_arg, "pull", "origin", "master" } 1132 else 1133 &.{ "git", "pull", "origin", "master" }, 1134 .cwd = .{ .path = client_path }, 1135 .stdin = .ignore, 1136 .stdout = .ignore, 1137 .stderr = .ignore, 1138 }); 1139 const term = try process.wait(io); 1140 if (term != .exited or term.exited != 0) { 1141 return error.GitCommandFailed; 1142 } 1143 } 1144 1145 // make sure pull was successful 1146 { 1147 const oid_master = (try client_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1148 try std.testing.expectEqualStrings(&commit1, &oid_master); 1149 } 1150 1151 // make another commit on the server 1152 const commit2 = blk: { 1153 const extra_txt = try server_repo.core.work_dir.createFile(io, "extra.txt", .{ .truncate = true }); 1154 defer extra_txt.close(io); 1155 try extra_txt.writeStreamingAll(io, "extra content"); 1156 try server_repo.add(io, allocator, &.{"extra.txt"}); 1157 break :blk try server_repo.commit(io, allocator, .{ .message = "add extra file" }); 1158 }; 1159 1160 // fetch with ref-in-want (git uses want-ref in protocol v2 when fetching named refs) 1161 { 1162 var process = try std.process.spawn(io, .{ 1163 .argv = if (is_ssh) 1164 &.{ "git", "-c", ssh_config_arg, "fetch", "origin", "master" } 1165 else 1166 &.{ "git", "fetch", "origin", "master" }, 1167 .cwd = .{ .path = client_path }, 1168 .stdin = .ignore, 1169 .stdout = .ignore, 1170 .stderr = .ignore, 1171 }); 1172 const term = try process.wait(io); 1173 if (term != .exited or term.exited != 0) { 1174 return error.GitCommandFailed; 1175 } 1176 } 1177 1178 // make sure fetch with want-ref was successful 1179 { 1180 const oid_remote_master = (try client_repo.readRef(io, .{ .kind = .{ .remote = "origin" }, .name = "master" })).?; 1181 try std.testing.expectEqualStrings(&commit2, &oid_remote_master); 1182 } 1183 } else { 1184 const refspecs = &.{ 1185 "+refs/heads/master:refs/heads/master", 1186 }; 1187 1188 const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name, port); 1189 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); 1190 1191 try client_repo.fetch( 1192 io, 1193 allocator, 1194 "origin", 1195 .{ .refspecs = refspecs, .wire = .{ .ssh = .{ 1196 .command = ssh_cmd_maybe, 1197 } } }, 1198 ); 1199 1200 // update the working dir 1201 try client_repo.restore(io, allocator, "."); 1202 } 1203 1204 // make sure fetch was successful 1205 { 1206 const oid_master = (try client_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1207 try std.testing.expectEqualStrings(&commit1, &oid_master); 1208 } 1209 } 1210 1211 fn testPushLarge( 1212 comptime repo_kind: rp.RepoKind, 1213 comptime transport_def: net.TransportDefinition, 1214 comptime shell_out_to_git: bool, 1215 comptime port: u16, 1216 io: std.Io, 1217 allocator: std.mem.Allocator, 1218 ) !void { 1219 const temp_dir_name = "temp-testnet-push-large"; 1220 1221 // create the temp dir 1222 const cwd = std.Io.Dir.cwd(); 1223 var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); 1224 if (temp_dir_or_err) |*temp_dir| { 1225 temp_dir.close(io); 1226 try cwd.deleteTree(io, temp_dir_name); 1227 } else |_| {} 1228 var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); 1229 defer cwd.deleteTree(io, temp_dir_name) catch {}; 1230 defer temp_dir.close(io); 1231 1232 // init server 1233 var server_process = try runServer(io, allocator, temp_dir_name, port); 1234 defer _ = server_process.kill(io); 1235 1236 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1237 defer allocator.free(cwd_path); 1238 1239 // register the repo under admin and locate its on-disk directory 1240 const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; 1241 defer allocator.free(server_path); 1242 1243 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path }); 1244 defer server_repo.deinit(io, allocator); 1245 1246 // add config 1247 try server_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "false" }); 1248 try server_repo.addConfig(io, allocator, .{ .name = "receive.denycurrentbranch", .value = "updateinstead" }); 1249 try server_repo.addConfig(io, allocator, .{ .name = "http.receivepack", .value = "true" }); 1250 1251 // export server repo 1252 { 1253 const export_file = try server_repo.core.repo_dir.createFile(io, "git-daemon-export-ok", .{}); 1254 defer export_file.close(io); 1255 } 1256 1257 const client_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "client" }); 1258 defer allocator.free(client_path); 1259 1260 var client_repo = try rp.Repo(repo_kind, .{ .is_test = true }).init(io, allocator, .{ .path = client_path }); 1261 defer client_repo.deinit(io, allocator); 1262 1263 var client_dir = try cwd.openDir(io, client_path, .{}); 1264 defer client_dir.close(io); 1265 1266 { 1267 const hello_txt = try client_repo.core.work_dir.createFile(io, "hello.txt", .{ .truncate = true }); 1268 defer hello_txt.close(io); 1269 try hello_txt.writeStreamingAll(io, "hello, world!"); 1270 try client_repo.add(io, allocator, &.{"hello.txt"}); 1271 } 1272 1273 // copy files from current repo into client dir 1274 for (&[_][]const u8{"src"}) |dir_name| { 1275 var src_repo_dir = try cwd.openDir(io, dir_name, .{ .iterate = true }); 1276 defer src_repo_dir.close(io); 1277 1278 var dest_repo_dir = try client_dir.createDirPathOpen(io, dir_name, .{}); 1279 defer dest_repo_dir.close(io); 1280 1281 try copyDir(io, src_repo_dir, dest_repo_dir); 1282 1283 try client_repo.add(io, allocator, &.{dir_name}); 1284 } 1285 1286 _ = try client_repo.commit(io, allocator, .{ .message = "let there be light" }); 1287 1288 // change the files so git will send them as delta objects 1289 for (&[_][]const u8{"src"}) |dir_name| { 1290 var dest_repo_dir = try client_dir.createDirPathOpen(io, dir_name, .{ .open_options = .{ .iterate = true } }); 1291 defer dest_repo_dir.close(io); 1292 1293 { 1294 var iter = dest_repo_dir.iterate(); 1295 while (try iter.next(io)) |entry| { 1296 switch (entry.kind) { 1297 .file => { 1298 const file = try dest_repo_dir.openFile(io, entry.name, .{ .mode = .read_write }); 1299 defer file.close(io); 1300 var writer = file.writer(io, &.{}); 1301 try writer.interface.writeAll("EDIT"); 1302 }, 1303 else => {}, 1304 } 1305 } 1306 } 1307 1308 try client_repo.add(io, allocator, &.{dir_name}); 1309 } 1310 1311 const commit2 = try client_repo.commit(io, allocator, .{ .message = "more stuff" }); 1312 1313 // add remote 1314 { 1315 const remote_url = try remoteUrl(transport_def, allocator, "testrepo", port); 1316 defer allocator.free(remote_url); 1317 1318 try client_repo.addRemote(io, allocator, .{ .name = "origin", .value = remote_url }); 1319 try client_repo.addConfig(io, allocator, .{ .name = "branch.master.remote", .value = "origin" }); 1320 } 1321 1322 const is_ssh = switch (transport_def) { 1323 .file => false, 1324 .wire => |wire_kind| .ssh == wire_kind, 1325 }; 1326 1327 if (shell_out_to_git) { 1328 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); 1329 defer allocator.free(priv_key_path); 1330 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}", .{ port + 1, priv_key_path }); 1331 defer allocator.free(ssh_config_arg); 1332 1333 // shell out to git so it will send delta objects 1334 var process = try std.process.spawn(io, .{ 1335 .argv = if (is_ssh) 1336 &.{ "git", "-c", ssh_config_arg, "push", "origin", "master" } 1337 else 1338 &.{ "git", "push", "origin", "master" }, 1339 .cwd = .{ .path = client_path }, 1340 .stdin = .ignore, 1341 .stdout = .ignore, 1342 .stderr = .ignore, 1343 }); 1344 const term = try process.wait(io); 1345 if (term != .exited or term.exited != 0) { 1346 return error.GitCommandFailed; 1347 } 1348 } else { 1349 const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name, port); 1350 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); 1351 1352 try client_repo.push( 1353 io, 1354 allocator, 1355 "origin", 1356 "master", 1357 false, 1358 .{ .wire = .{ .ssh = .{ 1359 .command = ssh_cmd_maybe, 1360 } } }, 1361 ); 1362 } 1363 1364 // make sure push was successful 1365 { 1366 const oid_master = (try server_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1367 try std.testing.expectEqualStrings(&commit2, &oid_master); 1368 1369 const hello_txt = try server_repo.core.work_dir.openFile(io, "hello.txt", .{}); 1370 defer hello_txt.close(io); 1371 } 1372 } 1373 1374 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1375 var iter = src_dir.iterate(); 1376 while (try iter.next(io)) |entry| { 1377 switch (entry.kind) { 1378 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1379 .directory => { 1380 try dest_dir.createDirPath(io, entry.name); 1381 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1382 defer dest_entry_dir.close(io); 1383 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1384 defer src_entry_dir.close(io); 1385 try copyDir(io, src_entry_dir, dest_entry_dir); 1386 }, 1387 else => {}, 1388 } 1389 } 1390 } 1391 1392 // the dev SSH public key matching the private key written by runServer 1393 const admin_ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKeIs8mJqigBZ5y84J4COgnAJJ5bHPKy+lM2SliMXbYm radar@roark"; 1394 1395 // create the admin event repo with a user holding the dev SSH public key 1396 fn setupAdmin(io: std.Io, allocator: std.mem.Allocator, data_dir_name: []const u8) !void { 1397 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1398 defer allocator.free(cwd_path); 1399 1400 const admin_repo_path = try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "admin" }); 1401 defer allocator.free(admin_repo_path); 1402 1403 var repo = try rp.Repo(.xit, evt.admin_repo_opts).init(io, allocator, .{ .path = admin_repo_path }); 1404 defer repo.deinit(io, allocator); 1405 1406 try repo.addConfig(io, allocator, .{ .name = "user.name", .value = "haxy" }); 1407 try repo.addConfig(io, allocator, .{ .name = "user.email", .value = "admin@haxy" }); 1408 1409 var prng = std.Random.DefaultPrng.init(std.testing.random_seed); 1410 const user_id = evt.EventWithId.randomId(prng.random()); 1411 1412 var password_hash_buf: [evt.User.password_hash_max_len]u8 = undefined; 1413 const password_hash = try evt.User.hashPassword("password", &password_hash_buf, io); 1414 1415 try evt.consume(.xit, evt.admin_repo_opts, io, allocator, &repo, evt.events_ref, &[_]evt.EventWithId{.{ 1416 .id = std.fmt.bytesToHex(user_id, .lower), 1417 .author = .{ .name = "admin", .email = "admin@example.test" }, 1418 .event = .{ .user = .{ 1419 .name = "admin", 1420 .email = "admin@example.test", 1421 .password_hash = password_hash, 1422 .ssh_keys = admin_ssh_key, 1423 } }, 1424 }}); 1425 } 1426 1427 // resolve admin/<repo_name> to its on-disk directory under <data_dir>/repos via 1428 // the event store 1429 fn repoOnDiskPath( 1430 io: std.Io, 1431 allocator: std.mem.Allocator, 1432 data_dir_name: []const u8, 1433 repo_name: []const u8, 1434 create: bool, 1435 ) !?[]u8 { 1436 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1437 defer allocator.free(cwd_path); 1438 1439 const admin_repo_path = try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "admin" }); 1440 defer allocator.free(admin_repo_path); 1441 1442 const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, "admin", repo_name, create)) orelse return null; 1443 return try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "repos", &event_id_hex }); 1444 } 1445 1446 // build the remote URL addressing admin/<repo_name> over the given transport 1447 fn remoteUrl( 1448 comptime transport_def: net.TransportDefinition, 1449 allocator: std.mem.Allocator, 1450 repo_name: []const u8, 1451 port: u16, 1452 ) ![]u8 { 1453 return switch (transport_def) { 1454 .file => unreachable, 1455 .wire => |wire_kind| switch (wire_kind) { 1456 .http => try std.fmt.allocPrint(allocator, "http://localhost:{}/admin/{s}", .{ port, repo_name }), 1457 .raw => try std.fmt.allocPrint(allocator, "git://localhost:{}/admin/{s}", .{ port, repo_name }), 1458 .ssh => try std.fmt.allocPrint(allocator, "git@localhost:admin/{s}", .{repo_name}), 1459 }, 1460 }; 1461 } 1462 1463 // the ssh command the haxy git client should invoke, or null when not using 1464 // ssh. haxy generates a fresh host key on every run, so accept the unknown host 1465 // and skip writing to known_hosts. 1466 fn sshCommand( 1467 is_ssh: bool, 1468 allocator: std.mem.Allocator, 1469 cwd_path: []const u8, 1470 temp_dir_name: []const u8, 1471 port: u16, 1472 ) !?[]u8 { 1473 if (!is_ssh) return null; 1474 1475 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); 1476 defer allocator.free(priv_key_path); 1477 1478 return try std.fmt.allocPrint(allocator, "ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -o IdentitiesOnly=yes -o IdentityFile=\"{s}\"", .{ port + 1, priv_key_path }); 1479 } 1480