mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
Merge branch 'git-rev-error' of https://github.com/Ma27/nix into master
This commit is contained in:
commit
f4a9fb67da
3 changed files with 58 additions and 9 deletions
|
@ -41,6 +41,19 @@ export _NIX_FORCE_HTTP=1
|
|||
path=$(nix eval --impure --raw --expr "(builtins.fetchGit file://$repo).outPath")
|
||||
[[ $(cat $path/hello) = world ]]
|
||||
|
||||
# Fetch a rev from another branch
|
||||
git -C $repo checkout -b devtest
|
||||
echo "different file" >> $TEST_ROOT/git/differentbranch
|
||||
git -C $repo add differentbranch
|
||||
git -C $repo commit -m 'Test2'
|
||||
git -C $repo checkout master
|
||||
devrev=$(git -C $repo rev-parse devtest)
|
||||
out=$(nix eval --impure --raw --expr "builtins.fetchGit { url = file://$repo; rev = \"$devrev\"; }" 2>&1) || status=$?
|
||||
[[ $status == 1 ]]
|
||||
[[ $out =~ 'Cannot find Git revision' ]]
|
||||
|
||||
[[ $(nix eval --raw --expr "builtins.readFile (builtins.fetchGit { url = file://$repo; rev = \"$devrev\"; allRefs = true; } + \"/differentbranch\")") = 'different file' ]]
|
||||
|
||||
# In pure eval mode, fetchGit without a revision should fail.
|
||||
[[ $(nix eval --impure --raw --expr "builtins.readFile (fetchGit file://$repo + \"/hello\")") = world ]]
|
||||
(! nix eval --raw --expr "builtins.readFile (fetchGit file://$repo + \"/hello\")")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue