git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>,
	Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH] pack-objects: handle island check for "external" delta base
Date: Wed, 19 Sep 2018 14:43:43 -0400	[thread overview]
Message-ID: <20180919184343.GA13014@sigill.intra.peff.net> (raw)
In-Reply-To: <CAN0heSpMRfDd7=E_kYL6ucL9bL2VWMGLTAkT72BUrVwR6YTezQ@mail.gmail.com>

On Wed, Sep 19, 2018 at 08:34:05PM +0200, Martin Ågren wrote:

> > +       /*
> > +        * First see if we're already sending the base (or it's explicitly in
> > +        * our "excluded" list.
> > +        */
> 
> Missing ')'.

Oops, yes.

> > +               if (use_delta_islands) {
> > +                       struct object_id base_oid;
> > +                       hashcpy(base_oid.hash, base_sha1);
> > +                       if (!in_same_island(&delta->idx.oid, &base_oid))
> > +                               return 0;
> 
> This does some extra juggling to avoid using `base->idx.oid`, which
> would have been the moral equivalent of the original code, but which
> won't fly since `base` is NULL.

Yeah, this is the actual bug-fix.

I wasn't happy about having to write in_same_island() twice, but writing
it the other way ended up pretty nasty, too. Something like:

  struct object_id ext_oid;
  struct object_id *base_oid;

  base = packlist_find(&to_pack, base_sha1, NULL);
  if (base) {
	base_oid = &base->idx.oid;
	*base_out = base;
  }
  else if (thin && bitmap_has_sha1_in_uninteresting(bitmap_git, base_sha1)) {
	hashcpy(ext_oid.hash, base_sha1);
	base_oid = &ext_oid;
	*base_out = NULL;
  } else {
	return 0;
  }

  if (use_island_marks && !in_same_island(&delta->idx.oid, base_oid))
	return 0;

  return 1;

That's less repetitive, but I feel like it's harder to follow which
variables are valid when.

> > +               if (can_reuse_delta(base_ref, entry, &base_entry)) {
> >                         oe_set_type(entry, entry->in_pack_type);
> >                         SET_SIZE(entry, in_pack_size); /* delta size */
> >                         SET_DELTA_SIZE(entry, in_pack_size);
> 
> Without being at all familiar with this code, this looks sane to me.
> Just had a small nit about the missing closing ')'.

Thanks for the review!

-Peff

      reply	other threads:[~2018-09-19 18:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 21:56 What's cooking in git.git (Sep 2018, #03; Fri, 14) Junio C Hamano
2018-09-15 20:17 ` Antonio Ospite
2018-09-17 15:11   ` Junio C Hamano
2018-09-16  6:39 ` Duy Nguyen
2018-09-16 15:09   ` Ævar Arnfjörð Bjarmason
2018-09-17  2:39   ` Jeff King
2018-09-17 17:51     ` Junio C Hamano
2018-09-17 18:22       ` Jeff King
2018-09-17 18:26         ` Jonathan Nieder
2018-09-16 12:01 ` brian m. carlson
2018-09-17 15:10   ` Junio C Hamano
2018-09-17 18:35 ` Derrick Stolee
2018-09-17 19:04   ` Junio C Hamano
2018-09-17 22:54 ` Junio C Hamano
2018-09-19  3:49 ` [PATCH] pack-objects: handle island check for "external" delta base Jeff King
2018-09-19 18:34   ` Martin Ågren
2018-09-19 18:43     ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180919184343.GA13014@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martin.agren@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).