Merge branch 'ps/ref-tests-update-more' into maint-2.43
[git.git] / t / t5301-sliding-window.sh
blob226490d60df3a61b6b9831118562c4a88bae1cc9
1 #!/bin/sh
3 # Copyright (c) 2006 Shawn Pearce
6 test_description='mmap sliding window tests'
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 test_expect_success 'setup' '
12 rm -f .git/index* &&
13 for i in a b c
15 echo $i >$i &&
16 test-tool genrandom "$i" 32768 >>$i &&
17 git update-index --add $i || return 1
18 done &&
19 echo d >d && cat c >>d && git update-index --add d &&
20 tree=$(git write-tree) &&
21 commit1=$(git commit-tree $tree </dev/null) &&
22 git update-ref HEAD $commit1 &&
23 git repack -a -d &&
24 test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
25 pack1=$(ls .git/objects/pack/*.pack) &&
26 test -f "$pack1"
29 test_expect_success 'verify-pack -v, defaults' '
30 git verify-pack -v "$pack1"
33 test_expect_success 'verify-pack -v, packedGitWindowSize == 1 page' '
34 git config core.packedGitWindowSize 512 &&
35 git verify-pack -v "$pack1"
38 test_expect_success 'verify-pack -v, packedGit{WindowSize,Limit} == 1 page' '
39 git config core.packedGitWindowSize 512 &&
40 git config core.packedGitLimit 512 &&
41 git verify-pack -v "$pack1"
44 test_expect_success 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' '
45 git config core.packedGitWindowSize 512 &&
46 git config core.packedGitLimit 512 &&
47 commit2=$(git commit-tree $tree -p $commit1 </dev/null) &&
48 git update-ref HEAD $commit2 &&
49 git repack -a -d &&
50 test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
51 pack2=$(ls .git/objects/pack/*.pack) &&
52 test -f "$pack2" &&
53 test "$pack1" \!= "$pack2"
56 test_expect_success 'verify-pack -v, defaults' '
57 git config --unset core.packedGitWindowSize &&
58 git config --unset core.packedGitLimit &&
59 git verify-pack -v "$pack2"
62 test_done