zig icon indicating copy to clipboard operation
zig copied to clipboard

`zig fetch --save` puts URL in already existing `.path` entry

Open dermetfan opened this issue 1 year ago • 2 comments

Zig Version

0.14.0-dev.1860+2e2927735

Steps to Reproduce and Observed Behavior

Given a build.zig.zon with a path dependency

.zqlite = .{ .path = "foo" },

when you fetch a URL dependency using

zig fetch --save https://github.com/karlseguin/zqlite.zig/archive/master.tar.gz

it puts the URL in the path field, resulting in an invalid dependency:

.zqlite = .{ .path = "https://github.com/karlseguin/zqlite.zig/archive/master.tar.gz", },

I'm providing a small repository so you can reproduce quickly: https://github.com/dermetfan/zig-issue-fetch-path

Expected Behavior

I believe it is reasonable for zig fetch --save to recognize this and write a valid dependency:

.zqlite = .{ .url = "https://github.com/karlseguin/zqlite.zig/archive/master.tar.gz", .hash = "<something>" },

dermetfan avatar Oct 13 '24 16:10 dermetfan

side note, you should never use branch names in your url refs; only tags or commits. otherwise its bound to break almost immediately

nektro avatar Oct 14 '24 01:10 nektro

Sure, this is just to keep the example short.

dermetfan avatar Oct 14 '24 07:10 dermetfan