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

Re: [PATCH 4/4] Show the branch type after the branch name for remotes

From
APAndy Parkins <andyparkins@gmail.com>
Date
Nov 3, 2006, 08:33 UTC
Message-ID
<200611030833.42596.andyparkins@gmail.com>
In-Reply-To
<7vy7qtl0bk.fsf@assigned-by-dhcp.cox.net>
On Friday 2006 November 03 02:40, Junio C Hamano wrote:
Show 9 quoted lines
> Andy Parkins <andyparkins@gmail.com> writes:
> > Instead of prefixing the remote branches with "remotes/" suffix them with
> > "[read only]"
>
> This is a change in UI and while I understand why you want to
> say r/o instead of remotes/, I think this needs a bit more
> thought and discussion.  People should not be feeding the output
> of "git branch" Porcelainish to their scripts, but you'll never
> know...

I intentionally made this patch in such a way as to leave the original form available. I haven't added a switch to show the original form, but it's there if it's needed.

The reason I thought it would be acceptable is that the output changed fairly significantly when git-branch went builtin.

Here's the original and my "git-branch -r" run on my git repository
$ git-branch -r
remotes/up/maint
remotes/up/master
remotes/up/next
remotes/up/pu
$ ./git-branch -r
  momentum/master
  up/maint
  up/master
  up/next
  up/pu

I've not touched the "-r" path, so this is the same as the unpatched builtin branch. The "remotes/" prefix is removed in refs.c by for_each_remote_ref() with do_for_each_ref("refs/remotes/", fn, 13, cb_data); and the spaces are added because print_ref_list() has only one printing path and that always includes spaces.

For me personally, I find my git-branch output more useful because in it's unswitched form it shows me all branches. However, I can easily put this behaviour under a switch or, and this would get my vote, put the original behaviour (i.e. show local branches only) under a switch.

Which would you like?  If any.
> By the way, does "git branch -r" (without any of your patches)
> even say "remotes/"?

I haven't touched the "-r" path, so that output should be unaffected. As mentioned above, git-branch.sh did include "remotes/", new builtin branch does not, but does include " " at the beginning of every line.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 of 23 in “Rename remote_only to display_mode”
  1. 2/4 Rename remote_only to display_modeAndy Parkins, Nov 2, 2006
  2. Junio C HamanoNov 3, 2006
  3. Andy ParkinsNov 3, 2006
  4. Andreas EricssonNov 3, 2006
  5. Junio C HamanoNov 3, 2006
  6. Andy ParkinsNov 3, 2006
  7. Andy ParkinsNov 3, 2006
  8. Andreas EricssonNov 3, 2006
  9. Add support to git-branch to show local and remote branchesAndy Parkins, Nov 3, 2006
  10. Colourise git-branch outputAndy Parkins, Nov 3, 2006
  11. Junio C HamanoNov 3, 2006
  12. Alex RiesenNov 3, 2006
  13. Junio C HamanoNov 3, 2006
  14. Andy ParkinsNov 3, 2006
  15. Junio C HamanoNov 3, 2006
  16. 3/4 Default to displaying /all/ non-tag refs, not just localsAndy Parkins, Nov 2, 2006
  17. Junio C HamanoNov 3, 2006
  18. Andy ParkinsNov 3, 2006
  19. Andreas EricssonNov 3, 2006
  20. 4/4 Show the branch type after the branch name for remotesAndy Parkins, Nov 2, 2006
  21. Junio C HamanoNov 3, 2006
  22. Andy ParkinsNov 3, 2006
  23. Junio C HamanoNov 3, 2006

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.