git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Michał Łowicki" <mlowicki@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: gsoc - Better git log --follow support
Date: Wed, 23 Mar 2011 12:20:23 -0400	[thread overview]
Message-ID: <20110323162023.GC30337@sigill.intra.peff.net> (raw)
In-Reply-To: <AANLkTi=woLeveur6gKnSXTRzmS8nB0o4M9HegJ+GNUCa@mail.gmail.com>

On Wed, Mar 23, 2011 at 12:23:45AM +0100, Michał Łowicki wrote:

> >  # But now look at it in gitk. Commit 4 is included as a boundary
> >  # commit, but we fail to notice that it connects to three. And we
> >  # don't see commit 3 connecting to anything, and commit 1 is missing
> >  # entirely.
> >  gitk --follow newfile
> 
> Why commit 4 is displayed here (changes only file2) ?

It's part of how gitk shows the graph. It shows all of the commits you
asked for with blue nodes, and then it shows the "boundary" commits with
a special white node. This lets you distinguish between actual root
commits (i.e., ones with no parents) and ones whose parents are simply
uninteresting to the current query.

> # git log with graph works here OK. It displays six -- five .. --
> three .. - one .In this case results shouldn't be similar to gitk ?
> git log --graph --follow newfile

Sort of. Notice the "..." in the output (it is easier to see with "git
log --graph --oneline --follow newfile). It is not showing the
simplified history, but instead indicates that there were some commits
omitted in between the two points. It doesn't make the output terrible
in such a simple linear case. But consider a case with branching:

  # Our A-B-C repo
  git init repo && cd repo
  echo content >file1 && git add file1 && git commit -m one
  echo content >file2 && git add file2 && git commit -m two
  echo content >>file1 && git add file1 && git commit -m three

  # Now make a side branch that also touches file1
  git checkout -b side HEAD^
  echo content >>file1 && git commit -a -m four

  # And merge them back to together
  git merge master

  # And then do our other commits with rename on top
  echo content >>file2 && git commit -a -m five
  git mv file1 newfile && git commit -m six
  echo content >>newfile && git commit -a -m seven

Showing "git log --graph --oneline --follow newfile" becomes a bit more
confusing. A simplified history would show "six" as the merge between
the two branches, but here it happens at some indeterminate point in the
history that is not shown.

And again, this is a simple example. For something more complex, try
this in git.git:

  # We know builtin-add.c got renamed to builtin/add.c, so
  # let's cheat and tell git which paths we're interested in.
  # The resulting graph is pretty readable, and is more or less what we
  # would want from --follow.
  git log --oneline --graph -- builtin-add.c builtin/add.c

  # Now try it with --follow. Not so pretty.
  git log --oneline --graph --follow builtin/add.c

-Peff

  reply	other threads:[~2011-03-23 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19 19:24 gsoc - Better git log --follow support Michał Łowicki
2011-03-19 21:57 ` GSoC - Better "git log --follow" support Jakub Narebski
2011-03-21 12:24 ` gsoc - Better git log --follow support Jeff King
2011-03-22 23:23   ` Michał Łowicki
2011-03-23 16:20     ` Jeff King [this message]
2011-03-23 16:58       ` Junio C Hamano
2011-03-23 17:06         ` Jeff King
2011-03-23 18:12           ` Junio C Hamano
2011-03-23 18:22             ` Jeff King
2011-04-13 21:04 ` Michał Łowicki
2011-04-15  4:06   ` Jonathan Nieder
2011-04-15 19:41     ` Michał Łowicki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110323162023.GC30337@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=mlowicki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).