3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='git-pack-object
18 dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i &&
19 git-update-cache --add $i || exit
21 cat c >d && echo foo >>d && git-update-cache --add d &&
22 tree=`git-write-tree` &&
23 commit=`git-commit-tree $tree </dev/null` && {
26 git-ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
28 git-diff-tree --root -p $commit &&
31 t=`git-cat-file -t $object` &&
32 git-cat-file $t $object || exit 1
37 'pack without delta' \
38 'git-pack-objects --window=0 test-1 <obj-list'
44 'unpack without delta' \
45 'GIT_OBJECT_DIRECTORY=.git2/objects &&
46 export GIT_OBJECT_DIRECTORY &&
48 git-unpack-objects test-1'
50 unset GIT_OBJECT_DIRECTORY
54 'check unpack without delta' \
55 '(cd ../.git && find objects -type f -print) |
58 cmp $path ../.git/$path || {
68 git-pack-objects test-2 <obj-list'
75 'GIT_OBJECT_DIRECTORY=.git2/objects &&
76 export GIT_OBJECT_DIRECTORY &&
78 git-unpack-objects test-2'
80 unset GIT_OBJECT_DIRECTORY
83 'check unpack with delta' \
84 '(cd ../.git && find objects -type f -print) |
87 cmp $path ../.git/$path || {
98 'use packed objects' \
99 'GIT_OBJECT_DIRECTORY=.git2/objects &&
100 export GIT_OBJECT_DIRECTORY &&
102 cp test-1.pack test-1.idx .git2/objects/pack && {
103 git-diff-tree --root -p $commit &&
106 t=`git-cat-file -t $object` &&
107 git-cat-file $t $object || exit 1
113 test_expect_success \
114 'use packed deltified objects' \
115 'GIT_OBJECT_DIRECTORY=.git2/objects &&
116 export GIT_OBJECT_DIRECTORY &&
117 rm -f .git2/objects/pack/test-?.idx &&
118 cp test-2.pack test-2.idx .git2/objects/pack && {
119 git-diff-tree --root -p $commit &&
122 t=`git-cat-file -t $object` &&
123 git-cat-file $t $object || exit 1