authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-29 05:30:35 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-29 05:30:35 -07:00
log1188d0979cfdf1cd3d2296c07c2ca6a798663b7c
tree6d677c95ebb8b409777f6a3e6dbb1cf965d1ac37
parent3eb06b1220ed6e006ddc3b42cc683129df6a43d5
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

cmd/generate: handle when dep is a commit-SHA


1 files changed, 13 insertions(+), 1 deletions(-)

src/util/module.zig+13-1
......@@ -176,7 +176,19 @@ pub const Module = struct {
176176 return switch (sub) {
177177 .local, .system_lib, .framework => unreachable,
178178 .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 }
180192 for (options.lock.?) |item| {
181193 if (!std.mem.eql(u8, item[1], "git")) continue;
182194 if (!std.mem.eql(u8, item[2], self.dep.?.path)) continue;