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

Re: [PATCH] Documentation update for 'git branch --list'

From
Vincent van Ravesteijn <vfr@lyx.org>
Date
Nov 22, 2011, 06:40 UTC
Message-ID
<4ECB43E4.7030607@lyx.org>
In-Reply-To
<7v7h2tgyw6.fsf@alter.siamese.dyndns.org>
Op 21-11-2011 18:37, Junio C Hamano schreef:
Show 11 quoted lines
> Vincent van Ravesteijn<vfr@lyx.org>  writes:
>
>> Indicate that the<pattern>... argument is only valid when using --list.
>> Otherwise a branch with the name<pattern>  will be created.
> I actually think there are some bugs in the implementation along that line
> and the way forward is to fix the implementation, instead of documenting
> the buggy behaviour.
>
> It is natural to expect "git branch --merged pu vr/\*" to list branches
> that are contained in 'pu' whose names match the given pattern, but it
> seems to try creating a branch called "vr/*" and fails, for example.

If this is what you naturally would expect, I would expect the following "git branch vr/*" to work as well.

What would you say if we try to interpret the argument as a pattern when the argument is not a valid ref name ? This includes all arguments containing '*'. In case of confusion we can demand the "--list" parameter to make clear what we mean.

Another thing is noticed is that the pattern use is different for 'git for-each-ref <pattern...>' and 'git branch --list <pattern...>'.

Two examples:
Show 13 quoted lines
> c:\Users\Vincent\Documents\git\git>git for-each-ref refs/heads/
> f56ef114eeefee755f422e6cbef2d83974cb90f1 commit refs/heads/master
> c2ee0c73bcb4d1980e5d0bb0d20912b565d8ae38 commit refs/heads/next
> e341d009b2e0374520ac72973c6e98d315218624 commit refs/heads/pu
> 5fd37a7da3df644a85887051ae36117c732d1781 commit refs/heads/vr/fix-crashes
> cec815158934d82cdef815ea1342be2c3edbc5c8 commit 
> refs/heads/vr/msvc-compile-fix
> 777963bd4a9f41ac3eae8de2a7b7177917d127e6 commit 
> refs/heads/vr/msvc-compile-fix-poll
>
> c:\Users\Vincent\Documents\git\git>git branch --list refs/heads/
>
> c:\Users\Vincent\Documents\git\git>
and
Show 8 quoted lines
> c:\Users\Vincent\Documents\git\git>git branch --list v*
>   vr/fix-crashes
>   vr/msvc-compile-fix
>   vr/msvc-compile-fix-poll
>
> c:\Users\Vincent\Documents\git\git>git for-each-ref v*
>
> c:\Users\Vincent\Documents\git\git>
Vincent
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 6 in “Documentation update for 'git branch --list'”
  1. Documentation update for 'git branch --list'Vincent van Ravesteijn, Nov 21, 2011
  2. Vincent van RavesteijnNov 21, 2011
  3. Junio C HamanoNov 21, 2011
  4. Vincent van RavesteijnNov 22, 2011
  5. Junio C HamanoNov 22, 2011
  6. Vincent van RavesteijnNov 30, 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.