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

Re: Git log follow question

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 14, 2010, 14:50 UTC
Message-ID
<alpine.LFD.2.00.1005140730030.3711@i5.linux-foundation.org>
In-Reply-To
<20100514043704.GC6075@coredump.intra.peff.net>
On Fri, 14 May 2010, Jeff King wrote:
> 
> I'm cc'ing Linus, who has more of a clue in both of those areas than I
> do.

I'm pretty sure I mentioned about this exact issue when I posted the original follow patches, and it basically boils down to: "--follow" is a total hack, and does _not_ use the regular commit filtering function, and as a result, fancy things like "--parent" don't really work well with it.

IOW, I'm not at all certain that it is fixable. "--follow_ is a very fundamentally non-gitty thing to do, and really is a complete hack. It's a fairly _small_ hack - if you didn't know better and looked at the source code, you might think that it fits very naturally into git. But no.

Now, it's possible that we could hack up --parent to work with --follow too, but quite frankly, I don't know how. Because the --follow hack really basically boils down to:

 - do _not_ prune commits at all (this the the thing that normally 
   simplifies the parenthood and removes uninteresting commits)
 - for the whole list of normal commits in "git log", do the patch 
   generation with a magic special hack that looks for renames.
 - if it was a rename, change the path that we magically track, so that 
   next commit that we look at, we'll follow the new (older) path.
 - if the patch is empty, we force-hide the commit (internally, this is 
   the "rev->always_show_header = 0;" thing)

and the key here is that we do all the magic at the _end_ of the queue, long after we've done the pruning of commits that normally does the parenthood renaming.

If we want --follow and --parent to work together, you'd need to move the special rename hack to be in the early phases. I'm sure it's possible. It might even be reasonably simple. But it's very fundamentally not what we do now.

And no, I'm unlikely to look at it. Sorry. I have used --follow occasionally, but it's a hack to see "ok, there it got renamed". It would be nice if "gitk --follow <pathname>" worked properly, but it's just not something I care very much about.

			Linus
Previous: Jeff KingNext: Martin Langhoff
Message 4 of 12 in “Git log follow question”
  1. Albert KrawczykMay 14, 2010
  2. Bo YangMay 14, 2010
  3. Jeff KingMay 14, 2010
  4. Linus TorvaldsMay 14, 2010
  5. Martin LanghoffMay 14, 2010
  6. Linus TorvaldsMay 14, 2010
  7. Jeff KingMay 25, 2010
  8. Linus TorvaldsMay 25, 2010
  9. Jeff KingMay 26, 2010
  10. Linus TorvaldsMay 26, 2010
  11. Albert KrawczykMay 14, 2010
  12. Albert KrawczykMay 14, 2010

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.