git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] unpack_entry: do not die when we fail to apply a delta

From
Jeff King <peff@peff.net>
Date
Jun 14, 2013, 22:19 UTC
Message-ID
<20130614221936.GD29138@sigill.intra.peff.net>
In-Reply-To
<7vk3lwmk0r.fsf@alter.siamese.dyndns.org>
On Fri, Jun 14, 2013 at 02:59:00PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 11 in “unpack_entry: do not die when we fail to apply a delta”
  1. unpack_entry: do not die when we fail to apply a deltaJeff King, Jun 13, 2013
  2. Nicolas PitreJun 14, 2013
  3. 0/2 recover from "failed to apply delta"Jeff King, Jun 14, 2013
  4. 1/2 t5303: drop "count=1" from corruption ddJeff King, Jun 14, 2013
  5. Junio C HamanoJun 14, 2013
  6. Jeff KingJun 14, 2013
  7. Junio C HamanoJun 14, 2013
  8. 2/2 unpack_entry: do not die when we fail to apply a deltaJeff King, Jun 14, 2013
  9. Junio C HamanoJun 14, 2013
  10. Jeff KingJun 14, 2013
  11. Junio C HamanoJun 14, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.