]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5301-sliding-window.sh
The third batch
[thirdparty/git.git] / t / t5301-sliding-window.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Shawn Pearce
4 #
5
6 test_description='mmap sliding window tests'
7
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 test_expect_success 'setup' '
12 rm -f .git/index* &&
13 for i in a b c
14 do
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"
27 '
28
29 test_expect_success 'verify-pack -v, defaults' '
30 git verify-pack -v "$pack1"
31 '
32
33 test_expect_success 'verify-pack -v, packedGitWindowSize == 1 page' '
34 git config core.packedGitWindowSize 512 &&
35 git verify-pack -v "$pack1"
36 '
37
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"
42 '
43
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"
54 '
55
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"
60 '
61
62 test_done