All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Taylor Blau <me@ttaylorr.com>
Cc: Jacob Vosmaer <jacob@gitlab.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/1] builtin/pack-objects.c: avoid iterating all refs
Date: Tue, 19 Jan 2021 18:33:34 -0500	[thread overview]
Message-ID: <YAdsTjDXImYlfTn8@coredump.intra.peff.net> (raw)
In-Reply-To: <YAdmb3EfNVHYavNk@nand.local>

On Tue, Jan 19, 2021 at 06:08:31PM -0500, Taylor Blau wrote:

> > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> > index 2a00358f34..2b32bc93bd 100644
> > --- a/builtin/pack-objects.c
> > +++ b/builtin/pack-objects.c
> > @@ -3740,7 +3740,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
> >  	}
> >  	cleanup_preferred_base();
> >  	if (include_tag && nr_result)
> > -		for_each_ref(add_ref_tag, NULL);
> > +		for_each_fullref_in("refs/tags/", add_ref_tag, NULL, 0);
> 
> Makes sense. I was curious why it wasn't this way from the beginning in
> f0a24aa56e (git-pack-objects: Automatically pack annotated tags if
> object was packed, 2008-03-03).
> 
> The patch doesn't say, but presumably it was because there wasn't any
> speed-up to be had iterating only a subset of references back then if
> they were packed (did packed refs even exist in 2008? unsure). In any
> case, builtin/pack-objects.c:add_ref_tag() discards anything that
> doesn't start with "refs/tags/", so I think your change is doing the
> right thing here.
> 
> That said, you could shorten this to use 'for_each_tag_ref()' instead
> (which compiles to the exact same thing).

You'd end up with "v1.2.3" in the refname field of the callback then,
rather than "refs/tags/v1.2.3". So we'd definitely need to drop the
prefix check in add_ref_tag() then (though I think it is a good idea
anyway). But I'm also not sure if it would interfere with peel_ref(),
and its magic for using packed-refs peeled information.

-Peff

  reply	other threads:[~2021-01-19 23:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 14:33 [PATCH 0/1] builtin/pack-objects.c: avoid iterating all refs Jacob Vosmaer
2021-01-19 14:33 ` [PATCH 1/1] " Jacob Vosmaer
2021-01-19 23:08   ` Taylor Blau
2021-01-19 23:33     ` Jeff King [this message]
2021-01-19 23:54       ` Taylor Blau
2021-01-19 23:15   ` Jeff King
2021-01-20  8:50   ` Ævar Arnfjörð Bjarmason
2021-01-20 15:02     ` Taylor Blau
2021-01-20 16:32       ` Ævar Arnfjörð Bjarmason
2021-01-20 19:53     ` Jeff King
2021-01-21 10:26       ` Ævar Arnfjörð Bjarmason
2021-01-21 15:34         ` Jeff King
2021-01-19 23:26 ` [PATCH 0/1] " Jeff King

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=YAdsTjDXImYlfTn8@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jacob@gitlab.com \
    --cc=me@ttaylorr.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.