Re: [PATCH] tag: do not show ambiguous tag names as "tags/foo"
On Sun, Jan 24, 2016 at 5:27 PM, Jeff King <peff@peff.net> wrote:
Show 19 quoted lines
> On Sun, Jan 24, 2016 at 02:19:52PM -0800, Junio C Hamano wrote:
>> Perhaps strip=2 can be defined to "strip 2 levels of
>> hierarchy prefix no matter what that is", and strip refs/tags/foo,
>> refs/heads/foo and refs/remotes/origin/foo to foo, foo, origin/foo,
>> respectively? The filtering natively done by the listing mode of
>> "branch" and "tags" would ensure the prefixes are always what we
>> implicitly expect, so the case we need to worry about how we should
>> signal errors becomes "what if there are not enough levels". That
>> may be simpler to handle.
>
> Yeah, "strip=2" would also get the job done, and extends more naturally
> to the branch case.
>
> To be honest, I cannot imagine anybody using anything _but_ strip=2, but
> maybe there are special cases, like:
>
> git for-each-ref --format='%(refname:strip=3)' refs/heads/jk/
>
> to get my list of topics, sans initials.
What if the option was named ":stripprefix=" in its most general form:
%(refname:stripprefix=refs/tags/)
with plain:
%(refname:stripprefix)
shorthand for ":stripprefix=refs/*/" or something?