Re: [RFC] Porting builtin/branch.c to use the printing options of ref-filter.{c,h}
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Aug 26, 2015, 09:02 UTC
- Message-ID
- <vpqlhcyqv6t.fsf@anie.imag.fr>
- In-Reply-To
- <CAOLa=ZRZpy8_KGNZL1TahEkOOdQ35e1168pwuCpkxbogRDXNnw@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 9 quoted lines
> It's more than just colors. The whole format changes. > > $ git branch -a > For local: > "%(if)%(HEAD)%(then)%(HEAD) %(color:green)%(refname:short)%(else) > %(refname:short)%(end)" > For remote: > " remotes/%(color:red)%(refname:short)%(color:reset)%(if)%(symref)%(then) > -> %(symref:short)%(end)"
I think both versions are not so different. You have %(if) on one format strings that would be disabled by construction on the second. For example, adding %(if)%(HEAD)%(then)%(HEAD) at the start of the format-string for remotes would be a no-op, right?
And in case a local branch is a symref, "git branch" displays "-> ..." both for local and for remotes. You just normally don't have local symref branches other than HEAD, but I tried:
$ git checkout -b branch $ cat .git/HEAD > .git/refs/heads/symref $ git branch -a * branch master symref -> branch
The only remaining difference I see are the "remotes/" prefix and colors.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/