Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / git / t / t5301-sliding-window.sh
blob9a6d6aceacc4851b566b7358f091a6038601cae0
1 #!/bin/sh
3 # Copyright (c) 2006 Shawn Pearce
6 test_description='mmap sliding window tests'
7 . ./test-lib.sh
9 dd () {
10 perl -e 'print pack("C", rand(256)) foreach 0 .. 32767'
13 test_expect_success \
14 'setup' \
15 'rm -f .git/index*
16 for i in a b c
18 echo $i >$i &&
19 test-genrandom "$i" 32768 >>$i &&
20 git update-index --add $i || return 1
21 done &&
22 echo d >d && cat c >>d && git update-index --add d &&
23 tree=`git write-tree` &&
24 commit1=`git commit-tree $tree </dev/null` &&
25 git update-ref HEAD $commit1 &&
26 git-repack -a -d &&
27 test "`git count-objects`" = "0 objects, 0 kilobytes" &&
28 pack1=`ls .git/objects/pack/*.pack` &&
29 test -f "$pack1"'
31 test_expect_success \
32 'verify-pack -v, defaults' \
33 'git verify-pack -v "$pack1"'
35 test_expect_success \
36 'verify-pack -v, packedGitWindowSize == 1 page' \
37 'git config core.packedGitWindowSize 512 &&
38 git verify-pack -v "$pack1"'
40 test_expect_success \
41 'verify-pack -v, packedGit{WindowSize,Limit} == 1 page' \
42 'git config core.packedGitWindowSize 512 &&
43 git config core.packedGitLimit 512 &&
44 git verify-pack -v "$pack1"'
46 test_expect_success \
47 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' \
48 'git config core.packedGitWindowSize 512 &&
49 git config core.packedGitLimit 512 &&
50 commit2=`git commit-tree $tree -p $commit1 </dev/null` &&
51 git update-ref HEAD $commit2 &&
52 git-repack -a -d &&
53 test "`git count-objects`" = "0 objects, 0 kilobytes" &&
54 pack2=`ls .git/objects/pack/*.pack` &&
55 test -f "$pack2"
56 test "$pack1" \!= "$pack2"'
58 test_expect_success \
59 'verify-pack -v, defaults' \
60 'git config --unset core.packedGitWindowSize &&
61 git config --unset core.packedGitLimit &&
62 git verify-pack -v "$pack2"'
64 test_done