login
Header Space

 
 

Re: "gitk" and "git log --graph": Strange behaviour with --follow

Previous thread: auto insert history info into source files, at commit? by oxcrete on Tuesday, April 8, 2008 - 12:03 pm. (3 messages)

Next thread: git clean removes directories when not asked to by Joachim B Haga on Tuesday, April 8, 2008 - 2:22 pm. (1 message)
To: Adam Simpkins <adam@...>
Cc: <git@...>
Date: Tuesday, April 8, 2008 - 12:42 pm

I found something very strange in graphical history tools "gitk" and
"git log --graph" when used with --follow. In Git repository compare the
following:

  $ gitk -- utf8.c
  $ gitk --follow -- utf8.c

The output of "git log --graph" is somewhat similar:

  $ git log --graph --pretty=oneline -- utf8.c
  $ git log --graph --pretty=oneline --follow -- utf8.c

All I can say is that the output is not intuitive at _all_. Almost all
the commits are in separate history lines.
--
To: <git@...>
Date: Wednesday, April 9, 2008 - 5:40 am

Yes, I see this behavior too.  The --follow option disables parent
rewriting, which gitk and "git log --graph" both rely on in this
instance.

Without --follow, the revision list is first pruned, and then the
parents are rewritten to include only those in the pruned list.  The
revision walk then occurs only over the pruned list.

With --follow, the revision list is not pruned, so parent rewriting
doesn't happen (and even if it did, I don't think it would have any
effect, since all commits are still in the list).  Instead, the
revision walk traverses all commits, but the log-tree/diff code simply
doesn't print any output for commits that aren't relevant.


I'm not familiar enough with the diff code to know the best way to fix
this.  One possible way might be to perform an extra revision walk in
revision.c before the "real" walk occurs.  This initial walk would
perform all of the diff calculations performed by the real walk, but
only for the purpose of pruning the list.  Then parent rewriting could
be done, and the "real" revision walk would only walk over the pruned
list.

-- 
Adam Simpkins
adam@adamsimpkins.net
--
Previous thread: auto insert history info into source files, at commit? by oxcrete on Tuesday, April 8, 2008 - 12:03 pm. (3 messages)

Next thread: git clean removes directories when not asked to by Joachim B Haga on Tuesday, April 8, 2008 - 2:22 pm. (1 message)
speck-geostationary