Skip to content

Commit c44a762

Browse files
committed
ignore dependencies that use ".path" instead of ".url/.hash"
1 parent 2360e35 commit c44a762

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/parse.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub fn parse(alloc: Allocator, deps: *StringHashMap(Dependency), file: File) !vo
5858

5959
var hash: ?[]const u8 = null;
6060
var url: ?[]const u8 = null;
61+
var has_path: bool = false;
6162

6263
var dep_buf: [2]Index = undefined;
6364
const dep_init = ast.fullStructInit(&dep_buf, dep_idx) orelse {
@@ -85,14 +86,16 @@ pub fn parse(alloc: Allocator, deps: *StringHashMap(Dependency), file: File) !vo
8586
}
8687
} else if (mem.eql(u8, name, "hash")) {
8788
hash = try parseString(alloc, ast, dep_field_idx);
89+
} else if (mem.eql(u8, name, "path")) {
90+
has_path = true;
8891
}
8992
}
9093

9194
if (url != null and hash != null) {
9295
dep.url = url.?;
9396
_ = try deps.getOrPutValue(hash.?, dep);
9497
} else {
95-
return error.parseError;
98+
if (!has_path) return error.InvalidDependency;
9699
}
97100
}
98101
}

0 commit comments

Comments
 (0)