Re: Fully peel tags via for-each-ref?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux