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

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

 



On Mon, Aug 19, 2019 at 10:50 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Bryan Turner <bturner@xxxxxxxxxxxxx> writes:
>
> > Is there any way, with "git for-each-ref", to output the "fully"
> > peeled SHA of a tag's ultimate target, regardless of how many layers
> > must be traversed?
>
>
> If %(*<stuff>) does not peel fully (I do not recall what I did
> offhand), because all other things in Git (like $X~0, $X^{tree},
> etc.) fully peel the outer object until they get to what they want,
> it may even be OK to declare it a bug and "fix" the notation to
> fully peel tags.  I dunno.

%(*<stuff>) definitely doesn't fully peel.

$ git for-each-ref --format="%(refname) %(objectname) ->
%(*objectname) (%(*objecttype))" refs/tags/
refs/tags/backdated_annotated_tag
80aa5be5ecf39660f798858482254f7a2ae9110e ->
57150c54c38d6570b2fd5e6d6cfc19476de44e84 (commit)
refs/tags/retagged_signed_tag 9b4e781dea0769888fe270e06ad76675f73851b1
-> 12ebe2a58367347cd39f19f5a72f3cbec7b8f9a9 (tag)
refs/tags/signed_tag 12ebe2a58367347cd39f19f5a72f3cbec7b8f9a9 ->
0a943a29376f2336b78312d99e65da17048951db (commit)

"retagged_signed_tag" is tagging "signed_tag", and you can see that
%(*objectname) for it is "signed_tag"'s hash and %(*objecttype) is
tag.

$ git rev-parse retagged_signed_tag~0
0a943a29376f2336b78312d99e65da17048951db

I don't know that this use case is common enough for it to warrant
"fixing". I'm not even sure most would call it a "bug"; I hadn't
considered it that way, at least. I was just interested in whether
there might be an out-of-the-box approach I wasn't aware of for
getting fully peeled results.

Thanks for taking the time to answer, and to provide a bit of history!

Best regards,
Bryan Turner



[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