fetchGit.sh: Test we don't "corrupt" cache if invoke w/o git avail

This commit is contained in:
Will Dietz 2018-01-09 08:58:19 -06:00
parent 7b9583680e
commit 84d9e213d2
1 changed files with 13 additions and 0 deletions

View File

@ -119,3 +119,16 @@ path4=$(nix eval --raw "(builtins.fetchGit $repo).outPath")
# Confirm same as 'dev' branch
path5=$(nix eval --raw "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath")
[[ $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 ]]