From ac527b0b7c9be37ad7f2f7d871b6e9b41fd0c431 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Fri, 16 Mar 2007 13:50:18 -0400 Subject: [PATCH] add test for OFS_DELTA objects Make sure pack-objects with --delta-base-offset works fine, and that it actually produces smaller packs as expected. Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- t/t5300-pack-object.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 17befde757..eacb1e92c2 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -64,7 +64,7 @@ test_expect_success \ cd "$TRASH" test_expect_success \ - 'pack with delta' \ + 'pack with REF_DELTA' \ 'pwd && packname_2=$(git-pack-objects test-2 current && diff expect current' - test_expect_success \ - 'use packed deltified objects' \ + 'use packed deltified (REF_DELTA) objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && rm .git2/objects/pack/test-* && @@ -127,11 +162,28 @@ test_expect_success \ } >current && diff expect current' +test_expect_success \ + 'use packed deltified (OFS_DELTA) objects' \ + 'GIT_OBJECT_DIRECTORY=.git2/objects && + export GIT_OBJECT_DIRECTORY && + rm .git2/objects/pack/test-* && + cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && { + git-diff-tree --root -p $commit && + while read object + do + t=`git-cat-file -t $object` && + git-cat-file $t $object || return 1 + done current && + diff expect current' + unset GIT_OBJECT_DIRECTORY test_expect_success \ 'verify pack' \ - 'git-verify-pack test-1-${packname_1}.idx test-2-${packname_2}.idx' + 'git-verify-pack test-1-${packname_1}.idx \ + test-2-${packname_2}.idx \ + test-3-${packname_3}.idx' test_expect_success \ 'corrupt a pack and see if verify catches' \ @@ -194,6 +246,13 @@ test_expect_success \ git-index-pack test-3.pack && cmp test-3.idx test-2-${packname_2}.idx && + cp test-3-${packname_3}.pack test-3.pack && + git-index-pack -o tmp.idx test-3-${packname_3}.pack && + cmp tmp.idx test-3-${packname_3}.idx && + + git-index-pack test-3.pack && + cmp test-3.idx test-3-${packname_3}.idx && + :' test_done -- cgit v1.2.3