Describe the bug
nix-build -E 'fetchGit { url = "https://github.com/NixOS/nixpkgs.git"; ref = "HEAD"; }' is broken by ee9fa0d
Steps To Reproduce
nix-build -E 'fetchGit { url = "https://github.com/NixOS/nixpkgs.git"; ref = "HEAD"; }'
observe error: resolving Git reference 'HEAD': revspec 'HEAD' not found
Expected behavior
fetchGit success, i.e. the tree
Metadata
nix-env (Nix) 2.31.1
Additional context
tazjin/nixery#174 (comment)
can be fixed by
--- a/src/libfetchers/git.cc
+++ b/src/libfetchers/git.cc
@@ -652,7 +652,7 @@ struct GitInputScheme : InputScheme
auto fetchRef = getAllRefsAttr(input) ? "refs/*:refs/*"
: input.getRev() ? input.getRev()->gitRev()
: ref.compare(0, 5, "refs/") == 0 ? fmt("%1%:%1%", ref)
- : ref == "HEAD" ? ref
+ : ref == "HEAD" ? "HEAD:HEAD"
: fmt("%1%:%1%", "refs/heads/" + ref);
repo->fetch(repoUrl.to_string(), fetchRef, shallow);
but I'm not sure if that goes against the spirit of #12386
Checklist
Add 👍 to issues you find important.
Describe the bug
nix-build -E 'fetchGit { url = "https://github.com/NixOS/nixpkgs.git"; ref = "HEAD"; }'is broken by ee9fa0dSteps To Reproduce
nix-build -E 'fetchGit { url = "https://github.com/NixOS/nixpkgs.git"; ref = "HEAD"; }'observe
error: resolving Git reference 'HEAD': revspec 'HEAD' not foundExpected behavior
fetchGitsuccess, i.e. the treeMetadata
nix-env (Nix) 2.31.1
Additional context
tazjin/nixery#174 (comment)
can be fixed by
but I'm not sure if that goes against the spirit of #12386
Checklist
Add 👍 to issues you find important.