mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
git fetcher: use resolveRef for getting revision of reference
* Add regression test * Fix 'no repo' test so it doesn't succeed if the data is still in cache * Use git_revparse_single inside git-utils instead of reimplementing the same logic.
This commit is contained in:
parent
c152c2767a
commit
60c2d15f5a
3 changed files with 14 additions and 21 deletions
|
@ -43,10 +43,18 @@ path0_=$(nix eval --impure --raw --expr "(builtins.fetchTree git+file://$TEST_RO
|
|||
export _NIX_FORCE_HTTP=1
|
||||
[[ $(tail -n 1 $path0/hello) = "hello" ]]
|
||||
|
||||
# Nuke the cache
|
||||
rm -rf $TEST_HOME/.cache/nix
|
||||
|
||||
# Fetch the default branch.
|
||||
path=$(nix eval --impure --raw --expr "(builtins.fetchGit file://$repo).outPath")
|
||||
[[ $(cat $path/hello) = world ]]
|
||||
|
||||
# Fetch when the cache has packed-refs
|
||||
# Regression test of #8822
|
||||
git -C $TEST_HOME/.cache/nix/gitv3/*/ pack-refs --all
|
||||
path=$(nix eval --impure --raw --expr "(builtins.fetchGit file://$repo).outPath")
|
||||
|
||||
# Fetch a rev from another branch
|
||||
git -C $repo checkout -b devtest
|
||||
echo "different file" >> $TEST_ROOT/git/differentbranch
|
||||
|
@ -251,6 +259,7 @@ path12=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = file://$repo
|
|||
|
||||
# should fail if there is no repo
|
||||
rm -rf $repo/.git
|
||||
rm -rf $TEST_HOME/.cache/nix
|
||||
(! nix eval --impure --raw --expr "(builtins.fetchGit \"file://$repo\").outPath")
|
||||
|
||||
# should succeed for a repo without commits
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue