mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Add a test for shallow Git clones
Also, don't return a revCount anymore for shallow or dirty Git trees, since it's incorrect. Closes #2988.
This commit is contained in:
parent
34c7645a58
commit
fbcb897e21
3 changed files with 21 additions and 6 deletions
|
@ -11,7 +11,7 @@ repo=$TEST_ROOT/git
|
|||
|
||||
export _NIX_FORCE_HTTP=1
|
||||
|
||||
rm -rf $repo ${repo}-tmp $TEST_HOME/.cache/nix/gitv* $TEST_ROOT/worktree
|
||||
rm -rf $repo ${repo}-tmp $TEST_HOME/.cache/nix/git* $TEST_ROOT/worktree $TEST_ROOT/shallow
|
||||
|
||||
git init $repo
|
||||
git -C $repo config user.email "foobar@example.com"
|
||||
|
@ -147,3 +147,9 @@ NIX=$(command -v nix)
|
|||
# Try again, with 'git' available. This should work.
|
||||
path5=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = $repo; ref = \"dev\"; }).outPath")
|
||||
[[ $path3 = $path5 ]]
|
||||
|
||||
# Check that shallow clones work and don't return a revcount.
|
||||
git clone --depth 1 file://$repo $TEST_ROOT/shallow
|
||||
path6=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = $TEST_ROOT/shallow; ref = \"dev\"; }).outPath")
|
||||
[[ $path3 = $path6 ]]
|
||||
[[ $(nix eval --impure --expr "(builtins.fetchTree { type = \"git\"; url = \"file://$TEST_ROOT/shallow\"; ref = \"dev\"; }).revCount or 123") == 123 ]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue