All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Bryan Turner <bturner@atlassian.com>, Git Users <git@vger.kernel.org>
Subject: Re: Fully peel tags via for-each-ref?
Date: Thu, 22 Aug 2019 00:24:45 -0400	[thread overview]
Message-ID: <20190822042445.GB4347@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqmug1rj7y.fsf@gitster-ct.c.googlers.com>

On Wed, Aug 21, 2019 at 08:07:29PM -0700, Junio C Hamano wrote:

> But after we learn that a ref "refs/tags/foo" points at a tag object
> that points at another tag object, what can the script do?  It
> cannot feed the other tag found that way back into --format=%(*<thing>)
> machinery of for-each-ref, as the command and its variants, the "--list"
> mode of "branch" and "tag" commands, only work on the object at the
> tip of refs.  The script must manually peel the tag one layer at a time.
> 
> And that "manually" has to be really manual.  No ^{<type>} suffix
> allows scripts to peel just one layer, so inside a loop, the script
> has to say "cat-file tag <object>" and parse the "object" header
> from the output.
> 
> The only thing that gets affected if we changed %(*<thing>) to fully
> peel tags is a tag that points at another tag, and the traditional
> behaviour to peel only one layer, while it _might_ have been done as
> a good first step to add more support for chain of trust, is not all
> that useful for such a tag, I am not sure if the current behaviour
> is defensible.

Yeah, well said, and I think this is the heart of the matter. There
isn't good tooling for this case, but even if there was, for-each-ref is
definitely not the place for it.

I took a brief look at making a patch, and it's unfortunately
non-trivial because of the way the deref logic in ref-filter is
implemented. So it may not be worth digging too far into for now if
nobody cares much either way.

I still have dreams of writing a more efficient and more reusable
version of ref-filter, and it would probably make sense to use
peel_ref() as part of that rewrite.

-Peff

      reply	other threads:[~2019-08-22  4:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 23:22 Fully peel tags via for-each-ref? Bryan Turner
2019-08-20  5:50 ` Junio C Hamano
2019-08-20 21:39   ` Bryan Turner
2019-08-21 23:00   ` Jeff King
2019-08-22  3:07     ` Junio C Hamano
2019-08-22  4:24       ` 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

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

  git send-email \
    --in-reply-to=20190822042445.GB4347@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bturner@atlassian.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.