mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
Merge pull request #1787 from dtzWill/fix/git-not-on-PATH
fix git cache 'corruption' when git not available, breaks all future use of fetchGit
This commit is contained in:
commit
3cd0704387
2 changed files with 13 additions and 1 deletions
|
@ -85,7 +85,6 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
|
||||||
Path cacheDir = getCacheDir() + "/nix/git";
|
Path cacheDir = getCacheDir() + "/nix/git";
|
||||||
|
|
||||||
if (!pathExists(cacheDir)) {
|
if (!pathExists(cacheDir)) {
|
||||||
createDirs(cacheDir);
|
|
||||||
runProgram("git", true, { "init", "--bare", cacheDir });
|
runProgram("git", true, { "init", "--bare", cacheDir });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,3 +119,16 @@ path4=$(nix eval --raw "(builtins.fetchGit $repo).outPath")
|
||||||
# Confirm same as 'dev' branch
|
# Confirm same as 'dev' branch
|
||||||
path5=$(nix eval --raw "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath")
|
path5=$(nix eval --raw "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath")
|
||||||
[[ $path3 = $path5 ]]
|
[[ $path3 = $path5 ]]
|
||||||
|
|
||||||
|
|
||||||
|
# Nuke the cache
|
||||||
|
rm -rf $TEST_HOME/.cache/nix/git
|
||||||
|
|
||||||
|
# Try again, but without 'git' on PATH
|
||||||
|
NIX=$(command -v nix)
|
||||||
|
# This should fail
|
||||||
|
(! PATH= $NIX eval --raw "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath" )
|
||||||
|
|
||||||
|
# Try again, with 'git' available. This should work.
|
||||||
|
path5=$(nix eval --raw "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath")
|
||||||
|
[[ $path3 = $path5 ]]
|
||||||
|
|
Loading…
Reference in a new issue