git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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/
Previous: Karthik Nayak
Message 6 of 6 in “[RFC] Porting builtin/branch.c to use the printing options of ref-filter.{c,h}”
  1. Karthik NayakAug 25, 2015
  2. Junio C HamanoAug 25, 2015
  3. Matthieu MoyAug 25, 2015
  4. Junio C HamanoAug 25, 2015
  5. Karthik NayakAug 26, 2015
  6. Matthieu MoyAug 26, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.