From: Jeff King <peff@peff.net>
To: Pete Harlan <pgit@tento.net>
Cc: Karthik Nayak <karthik.188@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] tag: do not show ambiguous tag names as "tags/foo"
Date: Sun, 24 Jan 2016 02:18:15 -0500 [thread overview]
Message-ID: <20160124071815.GB24084@sigill.intra.peff.net> (raw)
In-Reply-To: <20160124071234.GA24084@sigill.intra.peff.net>
On Sun, Jan 24, 2016 at 02:12:35AM -0500, Jeff King wrote:
> In theory, the ref-filter code could figure this out by us
> passing FILTER_REFS_TAGS. But there are two complications
> there:
>
> 1. The handling of refname:short is deep in formatting
> code that does not even have our ref_filter struct, let
> alone the arguments to the filter_ref struct.
>
> 2. In git v2.7.0, we expose the formatting language to the
> user. If we follow this path, it will mean that
> "%(refname:short)" behaves differently for "tag" versus
> "for-each-ref" (including "for-each-ref refs/tags/"),
> which can lead to confusion.
>
> Instead, let's extend the "short" modifier in the formatting
> language to handle a specific prefix. This fixes "git tag",
> and lets users invoke the same behavior from their own
> custom formats (for "tag" or "for-each-ref") while leaving
> ":short" with its same consistent meaning in all places.
I think the patch I posted is a reasonable way to go. But I also don't
think that having "%(refname:short)" behave specially for "git-tag" is
all that unreasonable, either. But I'm open to argument.
Here are a few more considerations I had.
- I'm not sure if the "special" behavior works as well for git-branch,
which may want to shorten both "refs/heads/" and "refs/remotes/",
depending on the type of ref.
My solution may not extend there naturally, either, depending on how
it is implemented.
- To let users get the same behavior out of for-each-ref, we could
perhaps auto-infer that looking at "refs/tags/" means shortening and
disambiguation should only happen with respect to the "refs/tags/"
hierarchy.
But I'm uncomfortable changing the meaning of ":short" without at
least a new option. And what would it mean for "git for-each-ref
refs/heads/foo/"? Would it shorten "refs/heads/foo/bar" to just
"bar", or would it still be "foo/bar"?
-Peff
next prev parent reply other threads:[~2016-01-24 7:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-23 23:56 Regression? Ambiguous tags listed as "tags/<foo>" Pete Harlan
2016-01-24 7:12 ` [PATCH] tag: do not show ambiguous tag names as "tags/foo" Jeff King
2016-01-24 7:18 ` Jeff King [this message]
2016-01-24 22:19 ` Junio C Hamano
2016-01-24 22:27 ` Jeff King
2016-01-24 23:39 ` Eric Sunshine
2016-01-25 9:56 ` Jeff King
2016-01-25 2:26 ` Junio C Hamano
2016-01-25 10:01 ` Jeff King
2016-01-25 19:29 ` Karthik Nayak
2016-01-25 20:21 ` Junio C Hamano
2016-01-26 2:37 ` Jeff King
2016-01-26 3:00 ` Jeff King
2016-01-26 3:25 ` Junio C Hamano
2016-01-24 23:05 ` Jeff King
2016-01-24 23:08 ` [PATCH 1/2] t6300: use test_atom for some un-modern tests Jeff King
2016-01-24 23:08 ` [PATCH 2/2] tag: do not show ambiguous tag names as "tags/foo" Jeff King
2016-01-26 0:04 ` Junio C Hamano
2016-01-26 4:25 ` Karthik Nayak
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=20160124071815.GB24084@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=pgit@tento.net \
/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).