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

Re: log --graph --first-parent weirdness

From
Adam Simpkins <adam@adamsimpkins.net>
Date
Jun 4, 2008, 18:04 UTC
Message-ID
<20080604180432.GA31437@adamsimpkins.net>
In-Reply-To
<20080604173820.GA3038@mithlond.arda.local>
On Wed, Jun 04, 2008 at 08:38:20PM +0300, Teemu Likonen wrote:
Show 17 quoted lines
> Junio C Hamano wrote (2008-06-04 10:12 -0700):
> 
> > Teemu Likonen <tlikonen@iki.fi> writes:
> > 
> > > The output of "git log --graph --first-parent" seems weird.
> 
> <snip>
> 
> > We could turn --graph automatically off if --first-parent is given,
> > but I tend to agree with you that the right behaviour is to show the
> > same "everything prefixed with '| ', wasting two columns without good
> > reason" output as you would see on a true linear history.
> 
> To me it's perfectly fine to turn off --graph when used with
> --first-parent, but yes, generally users might expect to see a line of
> M's, *'s and |'s there. At least it would clearly show which commits are
> merges and which are not.

It should be pretty simple to fix this as suggested. There are two places in graph.c where we loop over the current commit's parents. Changing those to break out after the first commit when revs->first_parent_only is set should result in the desired behavior.

I'll try to get some time this evening or tomorrow to create a patch.
-- 
Adam Simpkins
adam@adamsimpkins.net
Previous: Teemu LikonenNext: Adam Simpkins
Message 5 of 11 in “log --graph --first-parent weirdness”
  1. Teemu LikonenJun 4, 2008
  2. Teemu LikonenJun 4, 2008
  3. Junio C HamanoJun 4, 2008
  4. Teemu LikonenJun 4, 2008
  5. Adam SimpkinsJun 4, 2008
  6. graph API: fix "git log --graph --first-parent"Adam Simpkins, Jun 5, 2008
  7. Junio C HamanoJun 4, 2008
  8. Ping YinJun 5, 2008
  9. Adam SimpkinsJun 5, 2008
  10. Teemu LikonenJun 5, 2008
  11. Junio C HamanoJun 5, 2008

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.