Patrick Steinhardt forwarded a report from a user on IRC. Running 'git log --stat --follow -- include/linux/rsc_table.h' in linux.git takes about 33 seconds with Git 2.55 and almost 8 minutes with 2.56. He bisected it to 304812ed33 (log: improve --follow following renames for non-linear history) and Cc'd the commit's author.

Miklos Vajna measured about 28 seconds before that commit and 6m43s after it. He traced the cost to log_tree_diff(), which now diffs each merge against all of its parents with rename following. diff_tree_oid() only does the expensive rename detection when the path is added relative to a parent. That happens often for merges, for example when a branch forked before the path existed merges mainline.

His fix diffs the merge against its parents in two passes. The excerpt cuts off before the details of the first pass.

The series has four patches. The first adds t4219 tests for --follow cases across merges that already work but had no coverage. These include -c, --cc and --remerge-diff, a --no-ff merge taking a rename from the second parent in both commit orders, and a merge that keeps the path while the other side renamed it.

The second patch extracts the remerge/combined-diff display into a function. The third removes propagate_follow_pathspec_to_parent() and its loop, and records the path to follow for each parent inside the existing parent loop of log_tree_diff(). The fourth is the speedup. Vajna describes the third patch as taking Junio C Hamano's suggestion to start over.

The diffstat is 271 insertions and 58 deletions across log-tree.c and the new test file. The excerpts show no review of this iteration yet.