git-pack-objects: do the delta search in reverse size order
[git.git] / t / t5300-pack-object.sh
blob171af643e50768e4ccf4a45b142fbf70be9f04d6
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git-pack-object
9 . ./test-lib.sh
11 TRASH=`pwd`
13 test_expect_success \
14 'setup' \
15 'rm -f .git/index*
16 for i in a b c
18 dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i &&
19 git-update-cache --add $i || exit
20 done &&
21 cat c >d && echo foo >>d && git-update-cache --add d &&
22 tree=`git-write-tree` && {
23 echo $tree &&
24 git-ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
25 } >obj-list'
27 test_expect_success \
28 'pack without delta' \
29 'git-pack-objects --window=0 test-1 <obj-list'
31 rm -fr .git2
32 mkdir .git2
34 test_expect_success \
35 'unpack without delta' \
36 'GIT_OBJECT_DIRECTORY=.git2/objects &&
37 export GIT_OBJECT_DIRECTORY &&
38 git-init-db &&
39 git-unpack-objects test-1'
41 unset GIT_OBJECT_DIRECTORY
42 cd $TRASH/.git2
44 test_expect_success \
45 'check unpack without delta' \
46 '(cd ../.git && find objects -type f -print) |
47 while read path
49 cmp $path ../.git/$path || {
50 echo $path differs.
51 exit 1
53 done'
54 cd $TRASH
56 test_expect_success \
57 'pack with delta' \
58 'pwd &&
59 git-pack-objects test-2 <obj-list'
61 rm -fr .git2
62 mkdir .git2
64 test_expect_success \
65 'unpack with delta' \
66 'GIT_OBJECT_DIRECTORY=.git2/objects &&
67 export GIT_OBJECT_DIRECTORY &&
68 git-init-db &&
69 git-unpack-objects test-2'
71 unset GIT_OBJECT_DIRECTORY
72 cd $TRASH/.git2
73 test_expect_success \
74 'check unpack with delta' \
75 '(cd ../.git && find objects -type f -print) |
76 while read path
78 cmp $path ../.git/$path || {
79 echo $path differs.
80 exit 1
82 done'
83 cd $TRASH
85 test_done