From: Junio C Hamano <gitster@pobox.com>
To: "Jan Klötzke" <jan@kloetzke.net>
Cc: "Jeff King" <peff@peff.net>,
git@vger.kernel.org, "Steve Kemp" <steve@steve.org.uk>,
"René Scharfe" <l.s.r@web.de>,
"Stefan Beller" <stefanbeller@gmail.com>
Subject: Re: [PATCH] ref-filter: handle nested tags in --points-at option
Date: Wed, 05 Jul 2023 13:15:35 -0700 [thread overview]
Message-ID: <xmqq8rbuyv14.fsf@gitster.g> (raw)
In-Reply-To: <ZKW7bjVHeEOnza62@thinkpad.fritz.box> ("Jan Klötzke"'s message of "Wed, 5 Jul 2023 20:50:22 +0200")
Jan Klötzke <jan@kloetzke.net> writes:
> Am Wed, Jul 05, 2023 at 10:16:17AM -0700 schrieb Junio C Hamano:
>> Interesting. Right now, if I create a 'direct' tag that points
>> directly at HEAD, and then create an 'indirect' tag that points at
>> 'direct', i.e.
>>
>> $ git tag -a -m 'a direct tag to HEAD' direct HEAD
>> $ git tag -a -m 'an indirect tag' indirect direct
>>
>> I would get a piece of advice message that encourages to correct the
>> mistake with "git tag -f indirect direct^{}".
> ...
> But as most git commands can handle nested tags they should better be
> supported consistently IMHO.
Do they? Most git commands handle nested tags in only one way: by
fully peeling. "git checkout --detach indirect" in the above
scenario would handle nested tag "indirect" well, but it is done by
making "direct" tag inaccessible when the only thing you have is the
"indirect" tag. For example, you cannot create another "indirect"
tag that points at "direct" tag with "git tag", with
$ git tag -a -m 'another indirect' indirect-2 indirect^{}
The resulting tag will be another direct tag to the underlying
commit, and not a tag of the "direct" tag.
In that sense, --points-at we currently have that only peels once is
inconsistent with the others, but --points-at that peels repeatedly
and allows the intermediate steps to match is also behaving
inconsistently relative to most git commands.
Combined with the fact that we seem to discourage such an indirect
tag, we should either:
(1) declare that indirect tags are not useful, turn the warning
advice.nestedTag into a stronger error, devise appropriate
transition plan to get rid of nested tag (e.g. eventually
making it impossible to use "git tag" to create such a tag and
let "git fsck" complain about them), and perhaps change
"--points-at" to take only the fully peeled object into account
so that optimization based on packed-refs becomes possible. Or
(2) declare that indirect tags are useful thing to support, tone
down the advice.nestedTag message, and enhance the support of
indirect tags, starting with this "--points-at" enhancement.
I am inclined to support (2), but then a consistent support would
need to eventually include a "peel only a single level" primitive as
well. That would be the first step to allow "most git commands" to
support nested tags well, as they currently do not.
Thanks for working on this. Let's queue it, together will Peff's
patches (which I haven't studied fully yet).
prev parent reply other threads:[~2023-07-05 20:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-01 20:57 [PATCH] ref-filter: handle nested tags in --points-at option Jan Klötzke
2023-07-02 12:56 ` Jeff King
2023-07-02 16:25 ` René Scharfe
2023-07-02 20:27 ` Jeff King
2023-07-02 22:02 ` Jeff King
2023-07-02 22:33 ` [PATCH 0/3] a few --points-at optimizations/cleanups Jeff King
2023-07-02 22:35 ` [PATCH 1/3] ref-filter: avoid parsing tagged objects in match_points_at() Jeff King
2023-07-02 22:37 ` [PATCH 2/3] ref-filter: avoid parsing non-tags " Jeff King
2023-07-02 22:38 ` [PATCH 3/3] ref-filter: simplify return type of match_points_at Jeff King
2023-07-03 20:25 ` [PATCH] ref-filter: handle nested tags in --points-at option Jan Klötzke
2023-07-05 6:10 ` Junio C Hamano
2023-07-05 12:41 ` Jeff King
2023-07-05 17:16 ` Junio C Hamano
2023-07-05 18:50 ` Jan Klötzke
2023-07-05 20:15 ` Junio C Hamano [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=xmqq8rbuyv14.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jan@kloetzke.net \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
--cc=stefanbeller@gmail.com \
--cc=steve@steve.org.uk \
/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 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 NNTP newsgroup(s).