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

Re: Strange git-show-branch behavior.

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Nov 3, 2007, 18:22 UTC
Message-ID
<20071103182224.GA16345@atjola.homenet>
In-Reply-To
<871wb79q80.fsf@osv.gnss.ru>
On 2007.11.03 20:46:39 +0300, Sergei Organov wrote:
Show 50 quoted lines
> Hello,
> 
> I need to ask about git-show-branch once again as I really can't
> understand its behavior myself. Could please anybody either confirm bug(s) in
> git-show-branch, or explain why does it work this way.
> 
> Consider its invocation in a toy repository that has total 6 commits, as
> can be seen from this output:
> 
> $ git branch
> * master
>   mybranch
> $ git rev-list master mybranch --pretty=oneline
> e9217caffebd6311073867d410f0c6e46910a13d Go to sleep
> 5f19837be87493e9b284fe7db03f00f23d006d2e Merged mybranch
> 2e2a4956db9737faf5f4f296b895500fafab7350 Some fun.
> 6478a15c48b0a7ce28069310ff5e51f95b250c7c Some work.
> 48d3660dc2005471c27f1d5b09d334885b612380 Commit message
> 2c14c05709bde3c1a7bbdd7effbf73a5667fa265 Initial commit
> $
> 
> Or, using git-show-branch itself:
> 
> $ git-show-branch --more=9 master
> [master] Go to sleep
> [master^] Merged mybranch
> [master^^2] Some work.
> [master~2] Some fun.
> [master~3] Commit message
> [master~4] Initial commit
> $
> 
> [NOTE: the format of this output contradicts the manual page, but it's
>  not the topic of this post]
> 
> Now comes the confusion:
> 
> $ git-show-branch --more=9 master mybranch
> * [master] Go to sleep
>  ! [mybranch] Some work.
> --
> *  [master] Go to sleep
> *+ [mybranch] Some work.
> *  [master~2] Some fun.
> *+ [master~3] Commit message
> *+ [master~4] Initial commit
> $
> 
> In this output, why git doesn't show the merge commit having "Merged
> mybranch" commit message?
Because you didn't pass --sparse.
Show 15 quoted lines
> 
> Yet another confusion: 
> 
> $ git-show-branch master mybranch
> * [master] Go to sleep
>  ! [mybranch] Some work.
> --
> *  [master] Go to sleep
> *+ [mybranch] Some work.
> $
> 
> Why does it stop at "Some work." commit? The manual page says: "Usually
> the command stops output upon showing the commit that is the common
> ancestor of all the branches.", so I'd expect it should go down to
> "Commit message" commit that is the fork point.

Common ancestor means, that the commit is reachable through all refs. Let's take a look at your history:

         .-F-.  mybranch
        /     \
   A---B---C---D---E  master

There you can see that mybranch can of course reach F, and that master can reach it, too. E -> D -> F. So the output stops at F, not at B.

Björn
Previous: Sergei OrganovNext: Sergei Organov
Message 2 of 3 in “Strange git-show-branch behavior.”
  1. Sergei OrganovNov 3, 2007
  2. Björn SteinbrinkNov 3, 2007
  3. Sergei OrganovNov 8, 2007

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.