builtin/gc.c: ignore cruft packs with `--keep-largest-pack`
[alt-git.git] / t / t5301-sliding-window.sh
blob3ccaaeb397774da8978c5406840ec307ffe7564d
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 \
12 'setup' \
13 'rm -f .git/index* &&
14 for i in a b c
16 echo $i >$i &&
17 test-tool genrandom "$i" 32768 >>$i &&
18 git update-index --add $i || return 1
19 done &&
20 echo d >d && cat c >>d && git update-index --add d &&
21 tree=$(git write-tree) &&
22 commit1=$(git commit-tree $tree </dev/null) &&
23 git update-ref HEAD $commit1 &&
24 git repack -a -d &&
25 test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
26 pack1=$(ls .git/objects/pack/*.pack) &&
27 test -f "$pack1"'
29 test_expect_success \
30 'verify-pack -v, defaults' \
31 'git verify-pack -v "$pack1"'
33 test_expect_success \
34 'verify-pack -v, packedGitWindowSize == 1 page' \
35 'git config core.packedGitWindowSize 512 &&
36 git verify-pack -v "$pack1"'
38 test_expect_success \
39 'verify-pack -v, packedGit{WindowSize,Limit} == 1 page' \
40 'git config core.packedGitWindowSize 512 &&
41 git config core.packedGitLimit 512 &&
42 git verify-pack -v "$pack1"'
44 test_expect_success \
45 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' \
46 'git config core.packedGitWindowSize 512 &&
47 git config core.packedGitLimit 512 &&
48 commit2=$(git commit-tree $tree -p $commit1 </dev/null) &&
49 git update-ref HEAD $commit2 &&
50 git repack -a -d &&
51 test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
52 pack2=$(ls .git/objects/pack/*.pack) &&
53 test -f "$pack2" &&
54 test "$pack1" \!= "$pack2"'
56 test_expect_success \
57 'verify-pack -v, defaults' \
58 'git config --unset core.packedGitWindowSize &&
59 git config --unset core.packedGitLimit &&
60 git verify-pack -v "$pack2"'
62 test_done