From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Martin Koegler <mkoegler@auto.tuwien.ac.at>,
Sergey Vlasov <vsu@altlinux.ru>
Subject: [PATCH 2/3] t5300: add test for "unpack-objects --strict"
Date: Wed, 5 Mar 2008 02:09:07 -0800 [thread overview]
Message-ID: <1204711748-10044-2-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1204711748-10044-1-git-send-email-gitster@pobox.com>
This adds test for unpacking deltified objects with --strict option.
- unpacking full trees with --strict should pass;
- unpacking only trees with --strict should be rejected due to
missing blobs;
- unpacking only trees with --strict into an existing
repository with necessary blobs should succeed.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Third time lucky.
t/t5300-pack-object.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index cd3c149..b297393 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -274,4 +274,53 @@ test_expect_success \
packname_4=$(git pack-objects test-4 <obj-list) &&
test 3 = $(ls test-4-*.pack | wc -l)'
+test_expect_failure 'unpacking with --strict' '
+
+ git config --unset pack.packsizelimit &&
+ COPYING=$(git hash-object -w ../../COPYING) &&
+ for j in a b c d e f g
+ do
+ for i in 0 1 2 3 4 5 6 7 8 9
+ do
+ o=$(echo $j$i | git hash-object -w --stdin) &&
+ echo "100644 $o 0 $j$i"
+ done
+ done >LIST &&
+ rm -f .git/index &&
+ git update-index --index-info <LIST &&
+ LIST=$(git write-tree) &&
+ rm -f .git/index &&
+ head -n 10 LIST | git update-index --index-info &&
+ LI=$(git write-tree) &&
+ rm -f .git/index &&
+ tail -n 10 LIST | git update-index --index-info &&
+ ST=$(git write-tree) &&
+ PACK5=$( git rev-list --objects "$LIST" "$LI" "$ST" | \
+ git pack-objects test-5 ) &&
+ PACK6=$( (
+ echo "$LIST"
+ echo "$LI"
+ echo "$ST"
+ ) | git pack-objects test-6 ) &&
+ test_create_repo test-5 &&
+ (
+ cd test-5 &&
+ git unpack-objects --strict <../test-5-$PACK5.pack &&
+ git ls-tree -r $LIST &&
+ git ls-tree -r $LI &&
+ git ls-tree -r $ST
+ ) &&
+ test_create_repo test-6 &&
+ (
+ # tree-only into empty repo -- many unreachables
+ cd test-6 &&
+ test_must_fail git unpack-objects --strict <../test-6-$PACK6.pack
+ ) &&
+ (
+ # already populated -- no unreachables
+ cd test-5 &&
+ git unpack-objects --strict <../test-6-$PACK6.pack
+ )
+'
+
test_done
--
1.5.4.3.529.gb25fb
next prev parent reply other threads:[~2008-03-05 10:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 10:09 [PATCH 1/3] unpack-objects: prevent writing of inconsistent objects Junio C Hamano
2008-03-05 10:09 ` Junio C Hamano [this message]
2008-03-05 10:09 ` [PATCH 3/3] unpack-objects: fix --strict handling Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204711748-10044-2-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mkoegler@auto.tuwien.ac.at \
--cc=vsu@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.