You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ nix repl
Welcome to Nix version 2.3.10. Type :? for help.
nix-repl> builtins.fetchGit { url = "https://github.com/NixOS/nix"; ref = "HEAD"; }
{ outPath = "/nix/store/32wd1lrf55ymaz1aysrqffpxfgkwl6m4-source"; rev = "dd77f71afe6733e9790dd001125c423cb648b7ce"; revCount = 10127; shortRev = "dd77f71"; }
But unstable Nix 2.4pre20210308_1c0e3e4 (latest nixUnstable in release-20.09) breaks if given ref = "HEAD":
$ ./result/bin/nix repl
Welcome to Nix version 2.4pre20210308_1c0e3e4. Type :? for help.
nix-repl> builtins.fetchGit { url = "https://github.com/NixOS/nix"; ref = "HEAD"; }
fetching Git repository 'https://github.com/NixOS/nix'fatal: couldn't find remote ref refs/heads/HEAD
error: program 'git' failed with exit code 128
Expected behavior
The documented default value of ref is HEAD, so Nix should also accept it when explicitly given. It works in stable Nix (2.3.10) but is broken in the latest nixUnstable code base.
Additional context
poetry2nix can end up calling builtins.fetchGit with ref = "HEAD", that's how I hit this issue.
Activity
fetchGit: don't prefix "refs/heads/" on ref = "HEAD"
fetchGit: don't prefix "refs/heads/" on ref = "HEAD"