summaryrefslogtreecommitdiff
path: root/t/t5300-pack-object.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-26 04:29:18 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-26 07:33:23 -0700
commit8ee378a0f00a56cbffedee21fdbba30870d84436 (patch)
tree78600eeaac28aa694b72a70d524b5d0f9839f15c /t/t5300-pack-object.sh
parentd116a45a9a505d9a58cdd1c79193f759316c440d (diff)
downloadgit-8ee378a0f00a56cbffedee21fdbba30870d84436.tar.gz
[PATCH] Finish initial cut of git-pack-object/git-unpack-object pair.
This finishes the initial round of git-pack-object / git-unpack-object pair. They are now good enough to be used as a transport medium: - Fix delta direction in pack-objects; the original was computing delta to create the base object from the object to be squashed, which was quite unfriendly for unpacker ;-). - Add a script to test the very basics. - Implement unpacker for both regular and deltified objects. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 't/t5300-pack-object.sh')
-rwxr-xr-xt/t5300-pack-object.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
new file mode 100755
index 0000000000..171af643e5
--- /dev/null
+++ b/t/t5300-pack-object.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='git-pack-object
+
+'
+. ./test-lib.sh
+
+TRASH=`pwd`
+
+test_expect_success \
+ 'setup' \
+ 'rm -f .git/index*
+ for i in a b c
+ do
+ dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i &&
+ git-update-cache --add $i || exit
+ done &&
+ cat c >d && echo foo >>d && git-update-cache --add d &&
+ tree=`git-write-tree` && {
+ echo $tree &&
+ git-ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
+ } >obj-list'
+
+test_expect_success \
+ 'pack without delta' \
+ 'git-pack-objects --window=0 test-1 <obj-list'
+
+rm -fr .git2
+mkdir .git2
+
+test_expect_success \
+ 'unpack without delta' \
+ 'GIT_OBJECT_DIRECTORY=.git2/objects &&
+ export GIT_OBJECT_DIRECTORY &&
+ git-init-db &&
+ git-unpack-objects test-1'
+
+unset GIT_OBJECT_DIRECTORY
+cd $TRASH/.git2
+
+test_expect_success \
+ 'check unpack without delta' \
+ '(cd ../.git && find objects -type f -print) |
+ while read path
+ do
+ cmp $path ../.git/$path || {
+ echo $path differs.
+ exit 1
+ }
+ done'
+cd $TRASH
+
+test_expect_success \
+ 'pack with delta' \
+ 'pwd &&
+ git-pack-objects test-2 <obj-list'
+
+rm -fr .git2
+mkdir .git2
+
+test_expect_success \
+ 'unpack with delta' \
+ 'GIT_OBJECT_DIRECTORY=.git2/objects &&
+ export GIT_OBJECT_DIRECTORY &&
+ git-init-db &&
+ git-unpack-objects test-2'
+
+unset GIT_OBJECT_DIRECTORY
+cd $TRASH/.git2
+test_expect_success \
+ 'check unpack with delta' \
+ '(cd ../.git && find objects -type f -print) |
+ while read path
+ do
+ cmp $path ../.git/$path || {
+ echo $path differs.
+ exit 1
+ }
+ done'
+cd $TRASH
+
+test_done