Subject: Re: [BUG] resolved deltas

From: Jeff King <[email-masked]>
Date: Sat, 23 Aug 2014 07:18:04 -0400

On Sat, Aug 23, 2014 at 07:04:59AM -0400, Jeff King wrote:

> On Sat, Aug 23, 2014 at 06:56:40AM -0400, Jeff King wrote:
> 
> > So I think your patch is doing the right thing.
> 
> By the way, if you want to add a test to your patch, there is
> infrastructure in t5308 to create packs with duplicate objects. If I
> understand the problem correctly, you could trigger this by having a
> delta object whose base is duplicated, even without the missing object.

This actually turned out to be really easy. The test below fails without
your patch and passes with it. Please feel free to squash it in.

diff --git a/t/t5308-pack-detect-duplicates.sh b/t/t5308-pack-detect-duplicates.sh
index 9c5a876..50f7a69 100755
--- a/t/t5308-pack-detect-duplicates.sh
+++ b/t/t5308-pack-detect-duplicates.sh
@@ -77,4 +77,19 @@ test_expect_success 'index-pack can reject packs with duplicates' '
 	test_expect_code 1 git cat-file -e $LO_SHA1
 '
 
+test_expect_success 'duplicated delta base does not trigger assert' '
+	clear_packs &&
+	{
+		A=01d7713666f4de822776c7622c10f1b07de280dc &&
+		B=e68fe8129b546b101aee9510c5328e7f21ca1d18 &&
+		pack_header 3 &&
+		pack_obj $A $B &&
+		pack_obj $B &&
+		pack_obj $B
+	} >dups.pack &&
+	pack_trailer dups.pack &&
+	git index-pack --stdin <dups.pack &&
+	test_must_fail git index-pack --stdin --strict <dups.pack
+'
+
 test_done