| ... | ... | @@ -176,7 +176,19 @@ pub const Module = struct { |
| 176 | 176 | return switch (sub) { |
| 177 | 177 | .local, .system_lib, .framework => unreachable, |
| 178 | 178 | .git => { |
| 179 | | if (options.lock == null) return try u.git_rev_HEAD(alloc, mdir); |
| 179 | if (options.lock == null) { |
| 180 | return u.git_rev_HEAD(alloc, mdir) catch |err| switch (err) { |
| 181 | error.ENOENT, error.NotAGitRepo => { |
| 182 | const cpath = extras.trimPrefixEnsure(self.clean_path, "v/") orelse return err; |
| 183 | var iter = std.mem.splitScalar(u8, cpath, '/'); |
| 184 | while (iter.next()) |segment| { |
| 185 | if (iter.peek() == null) return segment; |
| 186 | } |
| 187 | unreachable; |
| 188 | }, |
| 189 | else => |e| e, |
| 190 | }; |
| 191 | } |
| 180 | 192 | for (options.lock.?) |item| { |
| 181 | 193 | if (!std.mem.eql(u8, item[1], "git")) continue; |
| 182 | 194 | if (!std.mem.eql(u8, item[2], self.dep.?.path)) continue; |