Some context at the very beginning:
[~/clones/leftpad]$ git log --pretty=oneline --all
db1442a0556c2b133627ffebf455a78a1ced64b9 (HEAD -> master, tag: v0.0.1, origin/master, origin/HEAD) chore(release): 0.0.1
2cc67dc48e3a60ee9702ad01ac932c3ae5565d28 test: Add test suite with jsverify
6d086b454204e570d78c3d8d005e1d14f0291635 Create license
80683e5129cc49e4508d095ed77e6ec1dea65e37 (origin/greenkeeper/initial) docs(readme): add Greenkeeper badge
6f334bd795c1184e4de837968e13cfbdcaae6bd3 Repo and fix
74fccbddc0e108cbafe9afa952ee5b7600ae1422 First
This is where I started experimenting with Nix issue #5128 in Nix 2.10.3:
nix-repl> builtins.fetchGit {
ref = "db1442a0556c2b133627ffebf455a78a1ced64b9";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
url = "https://github.com/tmcw/leftpad";
}
fetching Git repository 'https://github.com/tmcw/leftpad'fatal: couldn't find remote ref refs/heads/db1442a0556c2b133627ffebf455a78a1ced64b9
error: program 'git' failed with exit code 128
using allRefs
it works alright:
nix-repl> builtins.fetchGit {
ref = "db1442a0556c2b133627ffebf455a78a1ced64b9";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
url = "https://github.com/tmcw/leftpad";
allRefs = true;
}
warning: could not update mtime for file '/home/toraritte/.cache/nix/gitv3/0240dfgnkwmgqs7sma8rns8wlwxiv40b1lddl2sg2i0hnw7ym5c0/refs/heads/db1442a0556c2b133627ffebf455a78a1ced64b9': No such file or directory
{ lastModified = 1493781506;
lastModifiedDate = "20170503031826";
narHash = "sha256-0DbZHwAdvEUiHo3brZyyxw0WdNQOsQwGZZz4tboN3v8=";
outPath = "/nix/store/8frq54wwgi63wqgkc7p6yrcljlx4zwzh-source";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
revCount = 5;
shortRev = "db1442a";
submodules = false;
}
Then tried fetching the branches with and without allRefs
, and the results were what was expected:
nix-repl> builtins.fetchGit { ref = "master"; url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1493781506;
lastModifiedDate = "20170503031826";
narHash = "sha256-0DbZHwAdvEUiHo3brZyyxw0WdNQOsQwGZZz4tboN3v8=";
outPath = "/nix/store/8frq54wwgi63wqgkc7p6yrcljlx4zwzh-source";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
revCount = 5;
shortRev = "db1442a";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "greenkeeper/initial"; url = "https://github.com/tmcw/leftpad
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "master"; url = "https://github.com/tmcw/leftpad"; allRefs =
true;}
{ lastModified = 1493781506;
lastModifiedDate = "20170503031826";
narHash = "sha256-0DbZHwAdvEUiHo3brZyyxw0WdNQOsQwGZZz4tboN3v8=";
outPath = "/nix/store/8frq54wwgi63wqgkc7p6yrcljlx4zwzh-source";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
revCount = 5;
shortRev = "db1442a";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "greenkeeper/initial"; url = "https://github.com/tmcw/leftpad
"; allRefs = true; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
... and this is very it got weird when calling builtins.fetchGit
only with url
and allRefs
:
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; allRefs = true; }
warning: could not update mtime for file '/home/toraritte/.cache/nix/gitv3/0240dfgnkwmgqs7sma8rns8wlwxiv40b1lddl2sg2i0hnw7ym5c0/refs/heads/80683e5129cc49e4508d095ed77e6ec1dea65e37': No such file or directory
fetching Git repository 'https://github.com/tmcw/leftpad'fatal: Refusing to point HEAD outside of refs/
warning: could not update cached head '80683e5129cc49e4508d095ed77e6ec1dea65e37' for 'https://github.com/tmcw/leftpad'
error: opening file '/home/toraritte/.cache/nix/gitv3/0240dfgnkwmgqs7sma8rns8wlwxiv40b1lddl2sg2i0hnw7ym5c0/refs/heads/80683e5129cc49e4508d095ed77e6ec1dea65e37': No such file or directory
At this point I was trying random individual commits with and without allRefs
, the results were again as expected:
nix-repl> builtins.fetchGit {
url = "https://github.com/tmcw/leftpad";
rev = "74fccbddc0e108cbafe9afa952ee5b7600ae1422";
}
{ lastModified = 1371605151;
lastModifiedDate = "20130619012551";
narHash = "sha256-+djyuUPJXNrQIQ1py4I7U3vrTq6RAtydzeORkEYRnLQ=";
outPath = "/nix/store/4plgfa6hjb4ba13jmrz32ckyvgr8bwf1-source";
rev = "74fccbddc0e108cbafe9afa952ee5b7600ae1422";
revCount = 1;
shortRev = "74fccbd";
submodules = false;
}
nix-repl> builtins.fetchGit {
url = "https://github.com/tmcw/leftpad";
allRefs = true;
rev = "74fccbddc0e108cbafe9afa952ee5b7600ae1422";
}
{ lastModified = 1371605151;
lastModifiedDate = "20130619012551";
narHash = "sha256-+djyuUPJXNrQIQ1py4I7U3vrTq6RAtydzeORkEYRnLQ=";
outPath = "/nix/store/4plgfa6hjb4ba13jmrz32ckyvgr8bwf1-source";
rev = "74fccbddc0e108cbafe9afa952ee5b7600ae1422";
revCount = 1;
shortRev = "74fccbd";
submodules = false;
}
nix-repl> builtins.fetchGit {
url = "https://github.com/tmcw/leftpad";
allRefs = true;
rev = "2cc67dc48e3a60ee9702ad01ac932c3ae5565d28";
}
{ lastModified = 1493781356;
lastModifiedDate = "20170503031556";
narHash = "sha256-Bal7zTLeH3bESQxywYFUHp3COhMOVWQv+/nqXS10i00=";
outPath = "/nix/store/833i34wqr0silj472z4rwzryzan4axna-source";
rev = "2cc67dc48e3a60ee9702ad01ac932c3ae5565d28";
revCount = 4;
shortRev = "2cc67dc";
submodules = false;
}
nix-repl> builtins.fetchGit {
url = "https://github.com/tmcw/leftpad";
allRefs = true;
rev = "2cc67dc48e3a60ee9702ad01ac932c3ae5565d28";
}
{ lastModified = 1493781356;
lastModifiedDate = "20170503031556";
narHash = "sha256-Bal7zTLeH3bESQxywYFUHp3COhMOVWQv+/nqXS10i00=";
outPath = "/nix/store/833i34wqr0silj472z4rwzryzan4axna-source";
rev = "2cc67dc48e3a60ee9702ad01ac932c3ae5565d28";
revCount = 4;
shortRev = "2cc67dc";
submodules = false;
}
Then tried url
and allRefs
only, got an error, and then things got weird again:
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; allRefs = true; }
warning: could not update mtime for file '/home/toraritte/.cache/nix/gitv3/0240dfgnkwmgqs7sma8rns8wlwxiv40b1lddl2sg2i0hnw7ym5c0/refs/heads/80683e5129cc49e4508d095ed77e6ec1dea65e37': No such fi
le or directory
fetching Git repository 'https://github.com/tmcw/leftpad'fatal: Refusing to point HEAD outside of refs/
warning: could not update cached head '80683e5129cc49e4508d095ed77e6ec1dea65e37' for 'https://github.com/tmcw/leftpad'
error: opening file '/home/toraritte/.cache/nix/gitv3/0240dfgnkwmgqs7sma8rns8wlwxiv40b1lddl2sg2i0hnw7ym5c0/refs/heads/80683e5129cc49e4508d095ed77e6ec1dea65e37': No such file or directory
The issue here is that re-issued the same command from above of fetching branches with and without allRefs
, and all call resulted in the exact same output:
The rev
result 80683e5129cc49e4508d095ed77e6ec1dea65e37
is the HEAD of branch greenkeeper/initial
.
nix-repl> builtins.fetchGit { ref = "master"; url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "master"; url = "https://github.com/tmcw/leftpad"; allRefs = true; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "greenkeeper/initial"; url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "greenkeeper/initial"; url = "https://github.com/tmcw/leftpad"; allRefs = true; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
Next, I was wondering if ref
even matters at this point so tried out invalid references, and it sure didn't:
nix-repl> builtins.fetchGit { ref = "whatever"; url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
nix-repl> builtins.fetchGit { ref = "gibberish"; url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
Then it didn't work simply by using URL:
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; }
fetching Git repository 'https://github.com/tmcw/leftpad'fatal: couldn't find remote ref refs/heads/80683e5129cc49e4508d095ed77e6ec1dea65e37
error: program 'git' failed with exit code 128
Exited and then re-started the nix repl
, tried out a couple of things, and after that fetching by only the URL worked again but the flaky behaviour remained. Maybe one should purge the ~/.cache
directory?
$ nix repl
Welcome to Nix 2.10.3. Type :? for help.
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; }
fetching Git repository 'https://github.com/tmcw/leftpad'fatal: couldn't find remote ref refs/heads/80683e5129cc49e4508d095ed77e6ec1dea65e37
error: program 'git' failed with exit code 128
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; allRefs = true;}
{ lastModified = 1493781506;
lastModifiedDate = "20170503031826";
narHash = "sha256-0DbZHwAdvEUiHo3brZyyxw0WdNQOsQwGZZz4tboN3v8=";
outPath = "/nix/store/8frq54wwgi63wqgkc7p6yrcljlx4zwzh-source";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
revCount = 5;
shortRev = "db1442a";
submodules = false;
}
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1493781506;
lastModifiedDate = "20170503031826";
narHash = "sha256-0DbZHwAdvEUiHo3brZyyxw0WdNQOsQwGZZz4tboN3v8=";
outPath = "/nix/store/8frq54wwgi63wqgkc7p6yrcljlx4zwzh-source";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
revCount = 5;
shortRev = "db1442a";
submodules = false;
}
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; ref = "greenkeeper/initial";}
{ lastModified = 1491858622;
lastModifiedDate = "20170410211022";
narHash = "sha256-8RO5tFUo/t8own92cdHiNzSZvzTLAvdo0rJHClvf1K0=";
outPath = "/nix/store/7xc8hnzspar6f9g177m8ixh6x2cizrwl-source";
rev = "80683e5129cc49e4508d095ed77e6ec1dea65e37";
revCount = 3;
shortRev = "80683e5";
submodules = false;
}
nix-repl> builtins.fetchGit { url = "https://github.com/tmcw/leftpad"; }
{ lastModified = 1493781506;
lastModifiedDate = "20170503031826";
narHash = "sha256-0DbZHwAdvEUiHo3brZyyxw0WdNQOsQwGZZz4tboN3v8=";
outPath = "/nix/store/8frq54wwgi63wqgkc7p6yrcljlx4zwzh-source";
rev = "db1442a0556c2b133627ffebf455a78a1ced64b9";
revCount = 5;
shortRev = "db1442a";
submodules = false;
}