1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-01 06:31:00 +01:00

libfetchers: Fix fetchGit with ref = "HEAD"

This seems to have been broken in ee9fa0d360.
Adding the HEAD:HEAD refspec looks like the correct solution.

Suggested-by: hxtmdev on github
This commit is contained in:
Sergei Zimmerman 2025-11-29 05:39:04 +03:00
parent 048a58d331
commit 18f3598d57
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

View file

@ -836,7 +836,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);