This should probably just raise an error when doing npins add git; either one uses it with --at <rev> --branch <name> or with --at <tag>. But currently, giving both appears to work, until it doesn't:
❯ npins init --bare
[INFO ] Welcome to npins!
[INFO ] Creating `npins` directory
[INFO ] Writing default.nix
[INFO ] Writing initial sources.json (empty)
[INFO ] Successfully written initial files to 'npins'.
❯ npins add git https://stuebinm.eu/git/nixq --at 0.0.2 --branch main
[INFO ] Adding 'nixq' …
repository: https://stuebinm.eu/git/nixq
branch: main
revision: 0.0.2
hash: 187p0i8dxy4glk8g1hwfvm8vl4pgfv9qj3lmy4rh8vjvygcqx8p1
❯ nix-instantiate --eval npins -A nixq.outPath
error:
… while calling the 'fetchGit' builtin
at /tmp/flake/npins/default.nix:26:43:
25| })
26| else assert repository.type == "Git"; builtins.fetchGit {
| ^
27| url = repository.url;
error: hash '0.0.2' has wrong length for hash type 'sha1'
This should probably just raise an error when doing
npins add git
; either one uses it with--at <rev> --branch <name>
or with--at <tag>
. But currently, giving both appears to work, until it doesn't: