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: *...@@ -99,7 +99,6 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *
99 if (!nocache and u.list_contains(options.already_fetched.items, p)) return p;99 if (!nocache and u.list_contains(options.already_fetched.items, p)) return p;
100 if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv;100 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" });
103 if (options.log and d.type != .local) {102 if (options.log and d.type != .local) {
104 u.print("fetch: {s}: {s}: {s}", .{ parent_name, @tagName(d.type), d.path });103 u.print("fetch: {s}: {s}: {s}", .{ parent_name, @tagName(d.type), d.path });
105 }104 }
...@@ -138,13 +137,10 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *...@@ -138,13 +137,10 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, options: *
138 }137 }
139 return pv;138 return pv;
140 }139 }
141 try d.type.pull(d.path, tempdir);140 try d.type.pull(d.path, pv);
142 if ((try u.run_cmd(tempdir, &.{ "git", "checkout", vers.string })) > 0) {141 if ((try u.run_cmd(pv, &.{ "git", "checkout", vers.string })) > 0) {
143 u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{ d.path, @tagName(vers.id), vers.string });142 u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{ d.path, @tagName(vers.id), vers.string });
144 }143 }
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());
148 if (vers.id != .branch) {144 if (vers.id != .branch) {
149 const pvd = try std.fs.cwd().openDir(pv, .{});145 const pvd = try std.fs.cwd().openDir(pv, .{});
150 try pvd.deleteTree(".git");146 try pvd.deleteTree(".git");