From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "René Scharfe" <l.s.r@web.de>,
"Shawn Pearce" <spearce@spearce.org>,
"Martin von Gagern" <Martin.vGagern@gmx.net>,
git@vger.kernel.org
Subject: [PATCH 3/2] t5309: mark delta-cycle failover tests as passing
Date: Sat, 30 Aug 2014 09:23:12 -0400 [thread overview]
Message-ID: <20140830132311.GA14709@peff.net> (raw)
In-Reply-To: <20140829205538.GD29456@peff.net>
t5309 checks that we detect and fail when there is a cycle
of deltas (i.e., A is a delta on B, which is a delta on A).
It also checks the cases where we have such a cycle, but we
have an extra copy of the object either in the same pack or
in another one. These cases are recoverable, because we can
use the alternate copy to reconstruct the delta object.
However, it did not work in practice (and the tests were
marked as expect_failure) because it led to us trying to
resolve some deltas multiple times, something we assert()
should not happen. E.g., we'd see the full base A, use it to
resolve delta B on top of A, then use that to resolve the
delta A on top of B, and then finally try resolving B on top
of A again.
Since the previous commit, we handle duplicate bases more
gracefully, and the tests pass. While we're here, let's also
make the tests a little more robust:
1. For the case of finding the extra base in the same
pack, we do not need to use --fix-thin; it should (and
does) work without it.
2. Confirm that the resulting pack has a duplicate object.
In the case of using --fix-thin to pull the object from
another pack, the duplicate is added to the pack by us
(this is a good thing, as otherwise future readers
would encounter the cycle again).
Signed-off-by: Jeff King <peff@peff.net>
---
An obvious follow-on to the other two patches.
The implications of this make me slightly nervous, though. In the
--fix-thin case, the resulting pack will have 3 objects:
- A as a delta on B
- B as a delta on A
- a full copy of either A (or B) provided by --fix-thin
We create a .idx that has duplicate entries for A. If a reader is trying
to reconstruct B and they find the full copy of A, they're fine. If they
find the delta copy, what happens?
Ideally the reader would say "hey, I can't reconstruct A here, let me
try to find another copy". But I am not sure if that happens, or if we
are even capable of finding another copy of A (certainly we can find one
in another pack, but I do not think we are smart enough to find a
duplicate in the same pack).
By definition, we have a copy in another pack here (that is where the
--fix-thin base came from), but there is nothing to guarantee that the
other pack lives on.
t/t5309-pack-delta-cycles.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/t/t5309-pack-delta-cycles.sh b/t/t5309-pack-delta-cycles.sh
index 3e7861b..5309095 100755
--- a/t/t5309-pack-delta-cycles.sh
+++ b/t/t5309-pack-delta-cycles.sh
@@ -56,13 +56,14 @@ test_expect_success 'index-pack detects REF_DELTA cycles' '
test_must_fail git index-pack --fix-thin --stdin <cycle.pack
'
-test_expect_failure 'failover to an object in another pack' '
+test_expect_success 'failover to an object in another pack' '
clear_packs &&
git index-pack --stdin <ab.pack &&
- git index-pack --stdin --fix-thin <cycle.pack
+ git index-pack --stdin --fix-thin <cycle.pack &&
+ test_must_fail git index-pack --strict --stdin --fix-thin <cycle.pack
'
-test_expect_failure 'failover to a duplicate object in the same pack' '
+test_expect_success 'failover to a duplicate object in the same pack' '
clear_packs &&
{
pack_header 3 &&
@@ -71,7 +72,8 @@ test_expect_failure 'failover to a duplicate object in the same pack' '
pack_obj $A
} >recoverable.pack &&
pack_trailer recoverable.pack &&
- git index-pack --fix-thin --stdin <recoverable.pack
+ git index-pack --stdin <recoverable.pack &&
+ test_must_fail git index-pack --strict --stdin <recoverable.pack
'
test_done
--
2.1.0.346.ga0367b9
next prev parent reply other threads:[~2014-08-30 13:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 11:35 [BUG] resolved deltas Petr Stodulka
2014-08-21 18:25 ` Petr Stodulka
2014-08-22 19:41 ` Martin von Gagern
2014-08-23 10:12 ` René Scharfe
2014-08-23 10:56 ` Jeff King
2014-08-23 11:04 ` Jeff King
2014-08-23 11:18 ` Jeff King
2014-08-25 16:39 ` René Scharfe
2014-08-28 22:08 ` Jeff King
2014-08-28 22:15 ` Jeff King
2014-08-28 23:04 ` Jeff King
2014-08-28 22:22 ` Jeff King
2014-08-28 23:14 ` Junio C Hamano
2014-08-29 20:55 ` Jeff King
2014-08-29 20:57 ` [PATCH 1/2] index-pack: fix race condition with duplicate bases Jeff King
2014-08-29 20:58 ` [PATCH 2/2] index-pack: handle duplicate base objects gracefully Jeff King
2014-08-29 21:56 ` Junio C Hamano
2014-08-29 22:08 ` Jeff King
2014-08-30 2:59 ` Shawn Pearce
2014-08-30 13:16 ` Jeff King
2014-08-30 16:00 ` René Scharfe
2014-08-31 15:17 ` Jeff King
2014-08-31 16:30 ` René Scharfe
2014-08-31 1:10 ` Shawn Pearce
2014-08-31 15:24 ` Jeff King
2014-08-31 22:23 ` Junio C Hamano
2014-08-30 13:23 ` Jeff King [this message]
2014-08-31 15:15 ` [PATCH 3/2] t5309: mark delta-cycle failover tests as passing Jeff King
2014-09-02 17:19 ` Junio C Hamano
2014-08-25 17:19 ` [BUG] resolved deltas Shawn Pearce
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=20140830132311.GA14709@peff.net \
--to=peff@peff.net \
--cc=Martin.vGagern@gmx.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=spearce@spearce.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).