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

Re: [PATCH] log: improve --follow following renames in merge commits

From
Miklos Vajna <vmiklos@collabora.com>
Date
Jun 4, 2026, 12:20 UTC
Message-ID
<aiFtpkk_xN1897IE@collabora.com>
In-Reply-To
<ahqDqSH7yfYVOOyE@collabora.com>
Hi Jeff,
On Sat, May 30, 2026 at 08:29:03AM +0200, Miklos Vajna <vmiklos@collabora.com> wrote:
> Could you please comment on this, if this tweaked rule and its
> implementation in the patch looks OK to you? Let me know if I should
> just wait some more.

Just to come back to this, the idea was to make the --follow behavior slightly more useful by not always assuming we should follow a first parent in merge commits, but see if only one parent has effective changes to the followed file, and if so, follow that one.

I did this by doing a diff on the followed path in each parent, then mark the parent as "interesting" if DIFF_FILE_VALID() says so. This is true if the file is touched or the rename happens inside the merge commit (vs that parent), but it's not true if the file is really not touched or the file only shows up as an addition. And if we have only have one interesting parent, then switch to this, even if it's not the first parent. With this rule, I think we address your worry case about "making some other cases" worse and this still works for the subtree case, and this is relatively easy to do.

What do you think?
Thanks,
Miklos
Previous: Miklos Vajna
Message 18 of 18 in “log: let --follow follow renames in merge commits”
  1. log: let --follow follow renames in merge commitsMiklos Vajna, May 12, 2026
  2. Miklos VajnaMay 19, 2026
  3. Junio C HamanoMay 19, 2026
  4. Junio C HamanoMay 19, 2026
  5. log: improve --follow following renames for non-linear historyMiklos Vajna, Jun 8, 2026
  6. Junio C HamanoJun 8, 2026
  7. log: improve --follow following renames for non-linear historyMiklos Vajna, Jun 11, 2026
  8. Junio C HamanoJun 11, 2026
  9. log: improve --follow following renames for non-linear historyMiklos Vajna, Jun 15, 2026
  10. log: improve --follow following renames for non-linear historyMiklos Vajna, Jun 22, 2026
  11. Junio C HamanoJun 22, 2026
  12. Miklos VajnaJun 23, 2026
  13. Junio C HamanoJun 12, 2026
  14. Miklos VajnaMay 20, 2026
  15. Jeff KingMay 22, 2026
  16. log: improve --follow following renames in merge commitsMiklos Vajna, May 23, 2026
  17. Miklos VajnaMay 30, 2026
  18. Miklos VajnaJun 4, 2026

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.