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

Re: how to use git merge -s subtree?

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 8, 2008, 06:57 UTC
Message-ID
<7vir24x0r2.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<BAYC1-PASMTP152065390CFAF8C09F0B60AE480@CEZ.ICE>
Sean <seanlkml@sympatico.ca> writes:
Show 5 quoted lines
> 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 <gitster@pobox.com>
      Move gitk to its own subdirectory
   gitk => gitk-git/gitk |    0 
   1 files changed, 0 insertions(+), 0 deletions(-)
  commit 7388bcbc5431552718dde5c3259d861d2fa75a12
  Author: Paul Mackerras <paulus@samba.org>
      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 <paulus@samba.org>
      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.

Previous: SeanNext: Miklos Vajna
Message 10 of 12 in “how to use git merge -s subtree?”
  1. Miklos VajnaJan 5, 2008
  2. SeanJan 6, 2008
  3. David Soria ParraJan 6, 2008
  4. SeanJan 6, 2008
  5. David Soria ParraJan 6, 2008
  6. Junio C HamanoJan 6, 2008
  7. SeanJan 6, 2008
  8. Junio C HamanoJan 7, 2008
  9. SeanJan 8, 2008
  10. Junio C HamanoJan 8, 2008
  11. Miklos VajnaJan 6, 2008
  12. David Soria ParraJan 6, 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.