]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5301-sliding-window.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t5301-sliding-window.sh
CommitLineData
2dee8af6
SP
1#!/bin/sh
2#
3# Copyright (c) 2006 Shawn Pearce
4#
5
6test_description='mmap sliding window tests'
e75d2f7f
ÆAB
7
8TEST_PASSES_SANITIZE_LEAK=true
2dee8af6
SP
9. ./test-lib.sh
10
cc0c1ad9
JC
11test_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
29test_expect_success 'verify-pack -v, defaults' '
30 git verify-pack -v "$pack1"
31'
32
33test_expect_success 'verify-pack -v, packedGitWindowSize == 1 page' '
34 git config core.packedGitWindowSize 512 &&
35 git verify-pack -v "$pack1"
36'
37
38test_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
44test_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
56test_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'
2dee8af6
SP
61
62test_done