git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, Git <git@vger.kernel.org>
Subject: Re: [PATCH v4 15/16] branch: use ref-filter printing APIs
Date: Wed, 13 Apr 2016 18:05:59 -0400	[thread overview]
Message-ID: <20160413220559.GC8712@sigill.intra.peff.net> (raw)
In-Reply-To: <CAOLa=ZQnM95mApOmYYZa3SeFq2af5FMmiqh0ZFZDn3EO8U9-Dg@mail.gmail.com>

On Thu, Apr 14, 2016 at 12:31:41AM +0530, Karthik Nayak wrote:

> On Wed, Apr 13, 2016 at 8:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
> >>> Having said that, doesn't this need to be further adjusted for
> >>> 95c38fb0 (branch: fix shortening of non-remote symrefs, 2016-04-03)?
> >>>
> >>> http://thread.gmane.org/gmane.comp.version-control.git/290622/focus=290624
> >>>
> >>
> >> That was one of the changes made in this version of the patch series :)
> >
> > But with this patch applied, it seems that the tests in Peff's fix
> > does not seem to pass.
> > If I understand correctly, "fix shortening" stops doing your
> > symref:short (which is to
> > shorten the usual "drop refs/heads, refs/remotes, etc.") and makes the
> > shortening
> > conditional. The target of a symref that is found in refs/heads/ gets
> > refs/heads and
> > nothing else stripped.
> 
> Having a look here, WRT to the patch v4 it seems the problem is that
> patch v4 doesn't support v2.6.x behavior, namely that cross-prefix symrefs will
> not be shortened at all. As per the format given in the last patch
> [16/16] it shortens
> the symref irrespective of being cross-prefix symrefs.
> 
> Would it be a good idea to enforce this as in v2.6.x or change it as
> to allow shortening
> of cross-prefix symrefs.

The cross-prefix behavior I put into the test is not something I feel
strongly about; it was mostly just restoring the earlier behavior. I do
think shortening everything is fine, too, as long as there's some way to
get the fully qualified ref. E.g., if `git branch` shows %(symref:short)
or %(symref:strip=2), by default, but you can ask for just %(symref) if
you want (which I think is how you have it implemented now, though I
notice that symrefs don't get nearly as many formatting options as
things like %(upstream)).

If anyone is machine-parsing git-branch output in the first place, they
are Doing It Wrong. And doubly so if they are relying on some obscure
shortening rules that I don't think were ever carefully designed. So I
think we should be free to change it here to what serves users best.

-Peff

  reply	other threads:[~2016-04-13 22:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-09 18:44 [PATCH v4 00/16] port branch.c to use ref-filter's printing options Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 01/16] ref-filter: implement %(if), %(then), and %(else) atoms Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 02/16] ref-filter: include reference to 'used_atom' within 'atom_value' Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 03/16] ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>) Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 04/16] ref-filter: modify "%(objectname:short)" to take length Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 05/16] ref-filter: move get_head_description() from branch.c Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 06/16] ref-filter: introduce format_ref_array_item() Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 07/16] ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 08/16] ref-filter: add support for %(upstream:track,nobracket) Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 09/16] ref-filter: make "%(symref)" atom work with the ':short' modifier Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 10/16] ref-filter: introduce symref_atom_parser() Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 11/16] ref-filter: introduce refname_atom_parser() Karthik Nayak
2016-04-14 20:43   ` Jeff King
2016-04-15 19:02     ` Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 12/16] ref-filter: add support for %(refname:dir) and %(refname:base) Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 13/16] ref-filter: allow porcelain to translate messages in the output Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 14/16] branch, tag: use porcelain output Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 15/16] branch: use ref-filter printing APIs Karthik Nayak
2016-04-12 20:40   ` Junio C Hamano
2016-04-12 21:05     ` Junio C Hamano
2016-04-13 10:49       ` Karthik Nayak
     [not found]         ` <CAPc5daUZvP03o+eb2ngvRtV=aoXWGnZH9FKj9bRCEj3MrCT8WQ@mail.gmail.com>
2016-04-13 19:01           ` Karthik Nayak
2016-04-13 22:05             ` Jeff King [this message]
2016-04-14 19:17               ` Karthik Nayak
2016-04-14 20:05                 ` Jeff King
2016-04-14 20:36                   ` Jeff King
2016-04-15 20:27                     ` Karthik Nayak
2016-04-15 21:09                       ` Jeff King
2016-04-16  0:11   ` Stefan Beller
2016-04-17 20:30     ` Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 16/16] branch: implement '--format' option 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=20160413220559.GC8712@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@gmail.com \
    /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).