authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-30 04:20:35 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-30 04:20:35 -07:00
logdec9b5404ff3e01edf1997b0febb698247e1189b
tree68577f94c26bb428c8bb424ff18e3b8ccb58e9fb
parentb7f1abbfc3bbca1e8fb669368e85d40c04f395ae

cmd/fetch- remove use of tempdir for git


1 files changed, 2 insertions(+), 6 deletions(-)

src/common.zig+2-6
......@@ -99,7 +99,6 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *
9999 if (!nocache and u.list_contains(options.already_fetched.items, p)) return p;
100100 if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv;
101101
102 const tempdir = try std.fs.path.join(gpa, &.{ basedir, "temp" });
103102 if (options.log and d.type != .local) {
104103 u.print("fetch: {s}: {s}: {s}", .{ parent_name, @tagName(d.type), d.path });
105104 }
......@@ -138,13 +137,10 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *
138137 }
139138 return pv;
140139 }
141 try d.type.pull(d.path, tempdir);
142 if ((try u.run_cmd(tempdir, &.{ "git", "checkout", vers.string })) > 0) {
140 try d.type.pull(d.path, pv);
141 if ((try u.run_cmd(pv, &.{ "git", "checkout", vers.string })) > 0) {
143142 u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{ d.path, @tagName(vers.id), vers.string });
144143 }
145 const td_fd = try std.fs.cwd().openDir(basedir, .{});
146 try std.fs.cwd().makePath(pv);
147 try td_fd.rename("temp", try d.clean_path_v());
148144 if (vers.id != .branch) {
149145 const pvd = try std.fs.cwd().openDir(pv, .{});
150146 try pvd.deleteTree(".git");