-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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>
- Loading branch information
Junio C Hamano
authored and
Linus Torvalds
committed
Jun 26, 2005
1 parent
d116a45
commit 8ee378a
Showing
3 changed files
with
261 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters