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

Re: [PATCH 0/5] RFC: patterns for branch list

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Aug 26, 2011, 08:30 UTC
Message-ID
<4E5759B1.50705@drmicha.warpmail.net>
In-Reply-To
<20110825175301.GC519@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 25.08.2011 19:53:
Show 20 quoted lines
> On Thu, Aug 25, 2011 at 10:30:16AM +0200, Michael J Gruber wrote:
> 
>> This mini series is about introducing patterns to the list mode of
>> 'git branch' much like the pattern for 'git tag -l'. There are several
>> related things which are to be considered for the ui design:
> 
>> [log vs tag vs branch]
> 
> I agree that the ideal UI change would be to move git-branch's "-l" to
> "-g", and make "-l|--list" work the same as it does for git-tag.
> 
> Even though branch is generally considered a porcelain, I worry a little
> about making that change. A script that wants to create a branch has no
> real choice other than to use "git branch" (OK, they can use
> "update-ref" themselves, but I seriously doubt that most scripts do so).
> However, I kind of doubt anyone actually uses "-l"; it is mostly
> pointless in the default config, so maybe it is safe.
> 
> Searching google code for "git.branch.*-l" turns up only one hit, and it
> is somebody who apparently thought that "-l" meant "list".
;)
Thanks for doing the search.
Show 15 quoted lines
>> Analogous to "git tag", "branch" has several modes, one of which is list mode.
>> It is currently activated (and possibly modified) by "-v" and "-vv", and when
>> there are no arguments. So, at the least,
>>
>> git branch -v[v] <pattern>
>>
>> should match just like "git tag -l <pattern>" does. And that is what the first
>> patch in my series does.
> 
> The order of your patches seems backwards to me. You add
> pattern-matching for "-v", but there is no way to get pattern-matching
> for the non-verbose case. Shouldn't "--list" come first?
> 
> Maybe I am just nitpicking, as I think the end result after the series
> is the same. I just found the first patch very confusing.

It's an RFC series to revive the discussion about what to aim for. Agreement about "--list" seems to be growing, so a natural first patch would introduce that.

Show 21 quoted lines
>> "git tag" should probably learn the same long option and others. And why not
>> verify tags given by a pattern?
> 
> Yeah, having them both do --list makes sense. Whether it is appropriate
> to glob for other operations, I don't know. I think you'd have to
> look at each operation individually.
> 
>> Both "tag" and "branch" could activate list mode automatically on an invalid
>> tag name rather than dieing:
>>
>> git tag v1.7.6\*
>> Warning: tag 'v1.7.6*' not found.
>> v1.7.6
>> v1.7.6-rc0
>> v1.7.6-rc1
>> v1.7.6-rc2
>> v1.7.6-rc3
>> v1.7.6.1
> 
> That just seems confusing to me. What is the exit status? Shouldn't the
> warning be "error: tag 'v1.7.6*' is not a valid tag name"?

Sure, and sorry, copied the wrong one. I'd just like to have the simple way to say "git branch peff/\*" at least as long as we don't have "-l" for "--list".

Show 12 quoted lines
>> -v[v] sanity
>> ============
>>
>> '-v' and '-vv' both take considerable time (because they need to walk).
>> It makes more sense to have '-v' display cheap output (upstream name)
>> and '-vv' add expensive output (ahead/behind info). '-vvv' could add super
>> expensive info (ahead/equivalent/behind a la cherry-mark).
> 
> I think the original rationale was not so much "how much time does it
> take", but rather "how much space do you want each line to take on your
> terminal". For many people, the upstream name in "-vv" is just
> cluttering noise.

According to my experience, the ahead/behind computations take so much time (in a git.git clone with my devel branches) that they render all "-v" versions unusable, unless I use a restrictive pattern.

On the other hand, I have branches based on all of origin/{master,next} and others, so having the upstream name is valuable.

Seems that I'm an outlier, though.
Show 11 quoted lines
> Tag and branch listing are really just specialized versions of
> for-each-ref. I wonder if it makes sense to do:
> 
>   1. Teach for-each-ref formats replacement tokens for ahead/behind
>      counts.
> 
>   2. Let the user specify a for-each-ref format for tag and branch
>      listing output. Then the various levels of "-v" just become some
>      special format strings, and the user is free to ask for whatever
>      they want (or even have "branch.defaultListFormat" to get it
>      without typing over and over).
for-each-peff ;)

For a moment, the use of the walker in builtin/branch.c even tricked me into thinking that it might not use for-each-ref at all. God forbid!

I actually like the format suggestion. Then we only need to discuss the default format, which is hopefully less of a problem. But that is something for later, I'll discard the -v[v[v]] patches for now. Have we unified log formats and for-each-ref formats and parsers already, btw? I recall some efforts.

Michael
Previous: Jeff KingNext: Junio C Hamano
Message 15 of 77 in “[RFC] branch: list branches by single remote”
  1. Michael SchubertAug 2, 2011
  2. Jeff KingAug 4, 2011
  3. Michael J GruberAug 16, 2011
  4. Michael SchubertAug 16, 2011
  5. Jeff KingAug 16, 2011
  6. Michael SchubertAug 24, 2011
  7. Michael J GruberAug 24, 2011
  8. Michael SchubertAug 24, 2011
  9. Junio C HamanoAug 24, 2011
  10. Thiago FarinaAug 25, 2011
  11. Junio C HamanoAug 25, 2011
  12. Michael J GruberAug 25, 2011
  13. 0/5 RFC: patterns for branch listMichael J Gruber, Aug 25, 2011
  14. Jeff KingAug 25, 2011
  15. Michael J GruberAug 26, 2011
  16. Junio C HamanoAug 26, 2011
  17. Jeff KingSep 7, 2011
  18. Michael J GruberSep 8, 2011
  19. 0/5 patterns for branch listMichael J Gruber, Aug 26, 2011
  20. 0/5 patterns for branch listMichael J Gruber, Aug 28, 2011
  21. 1/5 t6040: test branch -vvMichael J Gruber, Aug 28, 2011
  22. 2/5 git-tag: introduce long forms for the optionsMichael J Gruber, Aug 28, 2011
  23. 3/5 git-branch: introduce missing long forms for the optionsMichael J Gruber, Aug 28, 2011
  24. 4/5 branch: introduce --list optionMichael J Gruber, Aug 28, 2011
  25. Junio C HamanoAug 29, 2011
  26. Michael J GruberAug 29, 2011
  27. Junio C HamanoAug 29, 2011
  28. 5/5 branch: allow pattern argumentsMichael J Gruber, Aug 28, 2011
  29. Michael SchubertSep 6, 2011
  30. Michael J GruberSep 6, 2011
  31. Sverre RabbelierSep 6, 2011
  32. Michael J GruberSep 6, 2011
  33. 1/5 t6040: test branch -vvMichael J Gruber, Aug 26, 2011
  34. 2/5 git-tag: introduce long forms for the optionsMichael J Gruber, Aug 26, 2011
  35. Junio C HamanoAug 26, 2011
  36. Michael J GruberAug 28, 2011
  37. 3/5 git-branch: introduce missing long forms for the optionsMichael J Gruber, Aug 26, 2011
  38. Junio C HamanoAug 26, 2011
  39. Michael J GruberAug 28, 2011
  40. 4/5 branch: introduce --list optionMichael J Gruber, Aug 26, 2011
  41. Junio C HamanoAug 26, 2011
  42. Michael J GruberAug 28, 2011
  43. Jeff KingSep 7, 2011
  44. Michael J GruberSep 8, 2011
  45. 0/5 mg/branch-list amendmentMichael J Gruber, Sep 8, 2011
  46. 4/5 branch: introduce --list optionMichael J Gruber, Sep 8, 2011
  47. 5/5 branch: allow pattern argumentsMichael J Gruber, Sep 8, 2011
  48. Junio C HamanoSep 8, 2011
  49. Jeff KingSep 8, 2011
  50. Junio C HamanoSep 8, 2011
  51. Jeff KingSep 9, 2011
  52. Michael J GruberSep 9, 2011
  53. Junio C HamanoSep 9, 2011
  54. Michael J GruberSep 9, 2011
  55. Jeff KingSep 9, 2011
  56. t3200: test branch creation with -vMichael J Gruber, Sep 9, 2011
  57. Jeff KingSep 9, 2011
  58. Jeff KingSep 9, 2011
  59. Michael J GruberSep 10, 2011
  60. Jeff KingSep 13, 2011
  61. Michael J GruberSep 13, 2011
  62. t3200: clean up checks for file existenceJeff King, Sep 13, 2011
  63. Junio C HamanoSep 13, 2011
  64. Jeff KingSep 13, 2011
  65. 5/5 branch: allow pattern argumentsMichael J Gruber, Aug 26, 2011
  66. Junio C HamanoAug 26, 2011
  67. 1/5 branch: allow pattern argumentsMichael J Gruber, Aug 25, 2011
  68. Jeff KingAug 25, 2011
  69. Junio C HamanoAug 25, 2011
  70. Junio C HamanoAug 25, 2011
  71. 2/5 branch: introduce --list argumentMichael J Gruber, Aug 25, 2011
  72. Junio C HamanoAug 25, 2011
  73. Junio C HamanoAug 25, 2011
  74. 3/5 t6040; test branch -vvMichael J Gruber, Aug 25, 2011
  75. 4/5 branch: restructure -v vs. -vvMichael J Gruber, Aug 25, 2011
  76. Junio C HamanoAug 25, 2011
  77. 5/5 branch: give patchsame count with -vvvMichael J Gruber, Aug 25, 2011

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.