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

Re: [PATCH] builtin-branch: improve output when displaying remote branches

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2009, 05:42 UTC
Message-ID
<7vhc30qki2.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<76718490902112030x46bddd84r561705a6b4f9d4b4@mail.gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
Show 25 quoted lines
> On Wed, Feb 11, 2009 at 10:49 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Jay Soffian <jaysoffian@gmail.com> writes:
>>
>>> $ git branch -rv
>>>   origin/HEAD -> master
>>>   origin/html           6116912 Autogenerated HTML docs for v1.6.2-rc0-10-gf6b9
>>
>> Doesn't the misalignment between the above two bother you?
>
> This comment makes me sad. In fact, a previous iteration looked like this:
>
> $ git branch -rv
>  origin/HEAD -> master
>  origin/html   6116912 Autogenerated HTML docs for v1.6.2-rc0-10-gf6b9
>  origin/maint  7e1100e gitweb: add $prevent_xss option to prevent XSS
> by repository content
>  origin/man    67cb1a7 Autogenerated manpages for v1.6.2-rc0-10-gf6b9
>  origin/master f6b98e4 git-web--browse: Fix check for /bin/start
>  origin/next   417ce12 Merge branch 'master' into next
>  origin/pu     9d798e7 Merge branch 'db/foreign-scm' into pu
>  origin/todo   5ed7079 What's in update
>
> IOW, align based on the width of the branch name, completely ignoring
> the width of " -> ...". But I found that ugly. It was actually more
> work to get it the way it is.
Wouldn't something like this easier to read?
>  origin/HEAD   ------> master
>  origin/html   6116912 Autogenerated HTML docs for v1.6.2-rc0-10-gf6b9
>  origin/maint  7e1100e gitweb: add $prevent_xss option to prevent XSS

I am not sure about the long arrow. It may be easier to use "->" aligned th the right end, but that now falls into bikeshedding, so I'll leve that to the list.

Show 12 quoted lines
>> It can become something like:
>>
>>        if (newitem->kind == REF_REMOTE_BRANCH)
>>                newitem->dest = resolve_remote_symref(refname - 13);
>>        else
>>                newitem->dest = NULL;
>>        if (newitem->dest)
>>                ...
>>
>> no?
>
> Yes indeed.

Another thing you may want to consider is to introduce another variable "name" that is supposed to be the human readable part (i.e. refname-13 etc.) and leave the refname the full name starting from "refs/". The code to add and then subtract to go back and forth made my head spin when I read it.

Previous: Jay SoffianNext: Jay Soffian
Message 5 of 14 in “builtin-branch: improve output when displaying remote branches”
  1. builtin-branch: improve output when displaying remote branchesJay Soffian, Feb 10, 2009
  2. Jay SoffianFeb 11, 2009
  3. Junio C HamanoFeb 12, 2009
  4. Jay SoffianFeb 12, 2009
  5. Junio C HamanoFeb 12, 2009
  6. builtin-branch: improve output when displaying remote branchesJay Soffian, Feb 13, 2009
  7. Junio C HamanoFeb 13, 2009
  8. Jay SoffianFeb 13, 2009
  9. Junio C HamanoFeb 13, 2009
  10. Jay SoffianFeb 13, 2009
  11. builtin-branch: improve output when displaying remote branchesJay Soffian, Feb 13, 2009
  12. martin f krafftFeb 13, 2009
  13. Junio C HamanoFeb 13, 2009
  14. Johannes SixtFeb 13, 2009

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.