From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Nicolas Pitre <nico@fluxnic.net>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] unpack_entry: do not die when we fail to apply a delta
Date: Fri, 14 Jun 2013 18:19:36 -0400 [thread overview]
Message-ID: <20130614221936.GD29138@sigill.intra.peff.net> (raw)
In-Reply-To: <7vk3lwmk0r.fsf@alter.siamese.dyndns.org>
On Fri, Jun 14, 2013 at 02:59:00PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > test_expect_success \
> > + 'corruption of delta base reference pointing to wrong object' \
> > + 'create_new_pack --delta-base-offset &&
> > + git prune-packed &&
> > + printf "\220\033" | do_corrupt_object $blob_3 2 &&
>
> Interesting. You cheated in a different way with a hardcoded
> offset, instead of hardcoded knowledge of where the object name
> is stored in binary in the .idx file ;-)
Yes. We could get it with:
git show-index <"$pack.idx" |
cut -d' ' -f1 |
perl -e '
@pos = map { chomp; $_ } <>;
my $ofs = $pos[2] - $pos[0];
my @bin;
unshift @bin, $ofs & 127;
while ($ofs >>= 7) {
$ofs--;
unshift @bin, 128 | ($ofs & 127);
}
binmode STDOUT;
print chr for @bin;
'
if that's not too ugly. Maybe the REF_DELTA one is less ugly, then, as
it would not need to do the packed offset encoding, but just convert
$blob1 from hex into binary.
-Peff
next prev parent reply other threads:[~2013-06-14 22:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 23:26 [PATCH] unpack_entry: do not die when we fail to apply a delta Jeff King
2013-06-14 0:05 ` Nicolas Pitre
2013-06-14 21:49 ` [PATCH 0/2] recover from "failed to apply delta" Jeff King
2013-06-14 21:51 ` [PATCH 1/2] t5303: drop "count=1" from corruption dd Jeff King
2013-06-14 21:51 ` [PATCH 0/2] recover from "failed to apply delta" Junio C Hamano
2013-06-14 21:56 ` Jeff King
2013-06-14 22:23 ` Junio C Hamano
2013-06-14 21:53 ` [PATCH 2/2] unpack_entry: do not die when we fail to apply a delta Jeff King
2013-06-14 21:59 ` Junio C Hamano
2013-06-14 22:19 ` Jeff King [this message]
2013-06-14 14:53 ` [PATCH] " 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=20130614221936.GD29138@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@fluxnic.net \
/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).