╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ test.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1579 break :blk try std.fmt.allocPrint(allocator, "ssh -o UserKnownHostsFile=\"{s}\" -o IdentityFile=\"{s}\"", .{ known_hosts_path, priv_key_path }); 1580 } else null; 1581 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); 1582 1583 try client_repo.push( 1584 io, 1585 allocator, 1586 "origin", 1587 "master", 1588 false, 1589 .{ .wire = .{ .ssh = .{ 1590 .command = ssh_cmd_maybe, 1591 .receive_pack_command = receive_pack_command, 1592 } } }, 1593 ); 1594 1595 if (transport_def == .file) { 1596 // update the working dir 1597 try server_repo.restore(io, allocator, "."); 1598 } 1599 } 1600 1601 // make sure push was successful 1602 { 1603 const oid_master = (try server_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1604 try std.testing.expectEqualStrings(&commit2, &oid_master); 1605 1606 const hello_txt = try temp_dir.openFile(io, "server/hello.txt", .{}); 1607 defer hello_txt.close(io); 1608 } 1609 } 1610 1611 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1612 var iter = src_dir.iterate(); 1613 while (try iter.next(io)) |entry| { 1614 switch (entry.kind) { 1615 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1616 .directory => { 1617 try dest_dir.createDirPath(io, entry.name); 1618 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1619 defer dest_entry_dir.close(io); 1620 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1621 defer src_entry_dir.close(io); 1622 try copyDir(io, src_entry_dir, dest_entry_dir); 1623 }, 1624 else => {}, 1625 } 1626 } 1627 } 1628