╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
469 470 // tag the current HEAD as the next sequential version: v1, v2, and so on 471 fn addNextTag(repo: *rp.Repo(.xit, .{}), io: std.Io, allocator: std.mem.Allocator, n: *usize) !void { 472 var buf: [16]u8 = undefined; 473 const name = try std.fmt.bufPrint(&buf, "v{d}", .{n.*}); 474 _ = try repo.addTag(io, allocator, .{ .name = name }); 475 n.* += 1; 476 } 477 478 // recursively copy the contents of src_dir into dest_dir 479 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 480 var iter = src_dir.iterate(); 481 while (try iter.next(io)) |entry| { 482 switch (entry.kind) { 483 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 484 .directory => { 485 try dest_dir.createDirPath(io, entry.name); 486 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 487 defer dest_entry_dir.close(io); 488 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 489 defer src_entry_dir.close(io); 490 try copyDir(io, src_entry_dir, dest_entry_dir); 491 }, 492 else => {}, 493 } 494 } 495 } 496