Fetch a specific git commit hash or tag with build.zig.zon?

Hi,

I’ve read this topic about how to add a local project as a library with build.zig.zon, and it was very helpful and works fine. I also read about the option to reference specific commits on github by using something like https://github.com/[user]/archive/[commit-sha].tar.gz as a source for zig fetch.

My question is: is there a way with the zig package manager to fetch a local git hash or tag of a project?

My usecase: I use local git repositories in my filesystem for my projects (initialized with git init --bare), and I’d like to use one of them as a library, but only checkout a specific git hash or tag and use that.

So basically something like zig fetch --save --git-tag=v0.2.0 /home/user/dev/git_repos/my_lib // ← made-up syntax

Is that currently possible with the build system?
That would be cool, because I wouldn’t need a git submodule then.

Thanks!

Not at the moment

$ zig fetch git+file:///git/repo#ca8fb773b2d58c9ac74280250441208da4beb39d
error: unsupported URL scheme: git+file

I think you better run gitweb for this

1 Like

Ok, thanks! I’ll take a look at gitweb, but I’ll probably just keep using submodules then!

1 Like