All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: Git <git@vger.kernel.org>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Christian Couder <christian.couder@gmail.com>
Subject: Re: [RFC] Porting builtin/branch.c to use the printing options of ref-filter.{c,h}
Date: Tue, 25 Aug 2015 11:50:57 -0700	[thread overview]
Message-ID: <xmqq4mjnyzfy.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAOLa=ZRpMsFr2p=X+Z7z95W+0wGd9i5XaSDeVSmS-BUFCj6dWw@mail.gmail.com> (Karthik Nayak's message of "Tue, 25 Aug 2015 23:15:21 +0530")

Karthik Nayak <karthik.188@gmail.com> writes:

> I'm working on porting over the printing options of ref-filter to `git
> branch -l`.
> This is a follow up to
> http://article.gmane.org/gmane.comp.version-control.git/276377
>
> Theres a slight issue with this which I'd like to discuss about.
>
> When we use `-a` option in `git branch -l`
> It lists local branches and remotes with each having a different output format.
> This with reference to ref-filter would mean either
>
> 1. Change format in between local and remote refs

I thought the end result of consolidation would be for for-each-ref,
branch -l, and tag -l to be "first collect what to show, and then
show them according to a single format given".  How could it be
possible to switch format?  It's not even like each element collected
in the first phase is marked so that the second "display" phase know
which one is which.

> 2. Have a format like %(if)...local check....%(then)....local branch
> format....%(else)....remote format %(end).

That, if we had a working if/then/else/end, would be a good
demonstration of it.  

If this were only for internal use by "branch -l", it might be
overkill, but the end users with for-each-ref --format options would
want to do the same thing as built-in patterns, so it is a good goal
to aim at.

> I prefer the latter, but that might lead to a large format. Any suggestions?

A less ambitious option might be:

  3. Invent "%(refname:<some magic>)" format similar to
     %(refname:short) but does your thing depending on the prefix
     refs/heads/ and refs/remotes/.

but that will not work if the difference between local and remote
format is not merely textual (e.g. paint them in different color).

  reply	other threads:[~2015-08-25 18:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 17:45 [RFC] Porting builtin/branch.c to use the printing options of ref-filter.{c,h} Karthik Nayak
2015-08-25 18:50 ` Junio C Hamano [this message]
2015-08-25 20:06   ` Matthieu Moy
2015-08-25 20:47     ` Junio C Hamano
2015-08-26  6:39   ` Karthik Nayak
2015-08-26  9:02     ` Matthieu Moy

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=xmqq4mjnyzfy.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.