Subject: Re: how to use git merge -s subtree?

From: Junio C Hamano <[email-masked]>
Date: Mon, 07 Jan 2008 22:57:53 -0800

Sean <[email-masked]> writes:

> In the case of the "--follow" option though, the user might be forgiven
> for thinking in terms of files rather than paths.  Even the git-log
> documentation says for "--follow", "Continue listing the history of a
> file beyond renames".   Which at least implies that Git knows about
> file history, rather than just paths.

But you know git does not know nor care about "file" history.

And the thing is, I just tried this:

  $ git log --follow --pretty=short --stat gitk-git/gitk | head -n 20
  commit 62ba5143ec2ab9d4083669b1b1679355e7639cd5
  Author: Junio C Hamano <[email-masked]>

      Move gitk to its own subdirectory

   gitk => gitk-git/gitk |    0 
   1 files changed, 0 insertions(+), 0 deletions(-)

  commit 7388bcbc5431552718dde5c3259d861d2fa75a12
  Author: Paul Mackerras <[email-masked]>

      gitk: Use the UI font for the diff/old version/new version radio buttons

   gitk |    6 +++---
   1 files changed, 3 insertions(+), 3 deletions(-)

  commit cca5d946d692fde7ea5408a694cb4b1c97a5a838
  Author: Paul Mackerras <[email-masked]>

      gitk: Simplify the code for finding commits

So there is something else going on, if David actually tried to
follow "B/foo" that was subtree-merged from a parent that had it
at toplevel "foo" and "log --follow" did not work for him.

Two things that come to mind offhand are that (1) --follow looks
for a path that has similar contents elsewhere only when the
path it is following in the child disappears in the parent.  So
if you start from B/foo that was subtree-merged (i.e. the other
parent has foo at the top) into a parent that already had B/foo,
it will not follow the other parent that does not have B/foo;
(2) I do not know if the original example by David tried to use
"-n $count" offhand, but it seems that currently --follow does
not play well with -n (try the above gitk-git/gitk without
piping the result into "head -n 20" but instead by limiting with
"git log -3 --follow ..."); if that is the case that definitely
is a bug.