| ... | ... | @@ -86,13 +86,25 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module { |
| 86 | 86 | const v_type_s = iter.next().?; |
| 87 | 87 | if (std.meta.stringToEnum(u.GitVersionType, v_type_s)) |v_type| { |
| 88 | 88 | const ref = iter.rest(); |
| 89 | | if ((try run_cmd(p, &[_][]const u8{"git", "rev-parse", ref})) > 0) { |
| 89 | if (try u.does_file_exist(pv)) { |
| 90 | if (v_type == .branch) { |
| 91 | _ = try run_cmd(pv, &[_][]const u8{"git", "fetch"}); |
| 92 | _ = try run_cmd(pv, &[_][]const u8{"git", "pull"}); |
| 93 | } |
| 94 | moddir = pv; |
| 95 | break :blk; |
| 96 | } |
| 97 | if ((try run_cmd(p, &[_][]const u8{"git", "checkout", ref})) > 0) { |
| 90 | 98 | u.assert(false, "fetch: git: {}: {} {} does not exist", .{d.path, @tagName(v_type), ref}); |
| 99 | } else { |
| 100 | _ = try run_cmd(p, &[_][]const u8{"git", "checkout", "-"}); |
| 91 | 101 | } |
| 92 | 102 | _ = try run_cmd(null, &[_][]const u8{"git", "clone", d.path, pv}); |
| 93 | 103 | _ = try run_cmd(pv, &[_][]const u8{"git", "checkout", ref}); |
| 94 | | const pvd = try u.open_dir_absolute(pv); |
| 95 | | try pvd.deleteTree(".git"); |
| 104 | if (v_type != .branch) { |
| 105 | const pvd = try u.open_dir_absolute(pv); |
| 106 | try pvd.deleteTree(".git"); |
| 107 | } |
| 96 | 108 | moddir = pv; |
| 97 | 109 | } |
| 98 | 110 | else { |