git/Documentation/config
Miklos Vajna 304812ed33 log: improve --follow following renames for non-linear history
Have a repo with a subtree merge, do a 'git log --follow prefix/test.c',
the output only contains history in the outer repo, not commits that
were merged via a subtree merge.

What happens is that 'git log --follow' stores the followed path only in
opt->diffopt.pathspec, so in case the commit history is non-linear, and
multiple parents have renames to the followed path, then the end result
isn't really defined: the first commit that happens to be visited in one
of the parents update opt->diffopt.pathspec, and from that point, only
that updated path is visited.

Fix the problem by introducing a commit -> path map
(follow_pathspec_slab) that stores what will be a path to follow when
visiting that parent. At the top of log_tree_commit(), if the slab has
an entry for this commit, we replace opt->diffopt.pathspec with a path
from this entry, so the correct path is followed, even if an unrelated
sub-tree changed the path to be followed to something else. After
log_tree_diff() runs, we record each parent's path in the slab. As a
result, the walk order doesn't matter, which was exactly the source of
problems previously.

This helps with subtree merges (rename happens inside the merge commit),
but also fixes the general case when the rename happens in the history
of parents, not in the merge commit itself.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-22 05:45:09 -07:00
..
add.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
advice.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
alias.adoc doc: fix list continuation in alias.adoc 2026-03-03 09:59:31 -08:00
am.adoc doc: convert git-am synopsis and options to new style 2026-05-25 20:05:44 +09:00
apply.adoc doc: convert git-apply synopsis and options to new style 2026-05-25 20:05:44 +09:00
attr.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
bitmap-pseudo-merge.adoc pack-bitmap: reject pseudo-merge "sampleRate" of 0 2026-05-12 10:36:18 +09:00
blame.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
branch.adoc doc: improve formatting in branch section 2025-06-30 11:11:36 -07:00
browser.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
bundle.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
checkout.adoc doc: convert git-checkout manpage to new style 2025-05-27 07:50:58 -07:00
clean.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
clone.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
color.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
column.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
commit.adoc doc: config: mention core.commentChar on commit.cleanup 2025-05-27 15:31:06 -07:00
commitgraph.adoc commit-graph: add new config for changed-paths & recommend it in scalar 2025-10-22 10:40:11 -07:00
completion.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
core.adoc Merge branch 'pc/lockfile-pid' 2026-02-17 13:30:41 -08:00
credential.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
diff.adoc Merge branch 'bc/doc-adoc-not-txt' 2025-02-14 17:53:47 -08:00
difftool.adoc doc: convert git-difftool manual page to synopsis style 2026-04-06 09:38:18 -07:00
extensions.adoc Merge branch 'kn/ref-location' 2026-03-04 10:52:59 -08:00
fastimport.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
feature.adoc setup: use "reftable" format when experimental features are enabled 2025-07-07 06:26:21 -07:00
fetch.adoc fetch: add --negotiation-restrict option 2026-05-20 11:33:23 +09:00
filter.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
fmt-merge-msg.adoc doc: switch merge config description to new synopsis format 2025-05-27 07:51:00 -07:00
format.adoc Fix docs for format.commitListFormat 2026-04-22 16:16:24 -07:00
fsck.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
fsmonitor--daemon.adoc fsmonitor: implement filesystem change listener for Linux 2026-04-15 08:44:33 -07:00
gc.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
gitcvs.adoc completion: make sed command that generates config-list.h portable. 2025-06-02 17:21:49 -07:00
gitweb.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
gpg.adoc gpg-interface: expand gpg.program as a path 2025-07-14 10:07:02 -07:00
grep.adoc doc: convert git-grep synopsis and options to new style 2026-05-25 20:05:44 +09:00
gui.adoc config: document 'gui.GCWarning' 2025-12-09 07:38:56 +09:00
guitool.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
help.adoc Merge branch 'bc/doc-adoc-not-txt' 2025-02-14 17:53:47 -08:00
hook.adoc doc: hook: don’t self-link via config include 2026-05-22 09:36:20 +09:00
http.adoc doc: clarify http.emptyAuth values 2026-05-01 14:01:57 +09:00
i18n.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
imap.adoc doc: convert git-imap-send synopsis and options to new style 2026-05-25 20:05:45 +09:00
includeif.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
index.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
init.adoc submodule: allow runtime enabling extensions.submodulePathConfig 2026-01-12 11:56:56 -08:00
instaweb.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
interactive.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
log.adoc log: improve --follow following renames for non-linear history 2026-06-22 05:45:09 -07:00
lsrefs.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
mailinfo.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
mailmap.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
maintenance.adoc builtin/maintenance: use "geometric" strategy by default 2026-02-24 07:33:20 -08:00
man.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
merge.adoc merge/pull: extend merge.stat configuration variable to cover --compact-summary 2025-06-13 11:54:14 -07:00
mergetool.adoc doc: convert git-difftool manual page to synopsis style 2026-04-06 09:38:18 -07:00
notes.adoc Merge branch 'bc/doc-adoc-not-txt' 2025-02-14 17:53:47 -08:00
pack.adoc doc: fix plural agreement in pack.preferBitmapTips 2026-04-16 21:22:01 -07:00
pager.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
pretty.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
promisor.adoc doc: config: terminate runaway lists 2026-06-11 12:08:17 -07:00
protocol.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
pull.adoc pull: add pull.autoStash config option 2025-07-21 15:01:21 -07:00
push.adoc doc: clarify push.default=simple behavior 2026-05-26 20:11:29 +09:00
rebase.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
receive.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
reftable.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
remote.adoc send-pack: pass negotiation config in push 2026-05-20 11:33:24 +09:00
remotes.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
repack.adoc repack: introduce `--write-midx=incremental` 2026-05-20 11:31:14 +09:00
replay.adoc replay: add replay.refAction config option 2025-11-05 13:34:55 -08:00
rerere.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
revert.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
safe.adoc Merge branch 'ta/doc-config-adoc-fixes' 2026-06-17 11:10:11 -07:00
sendemail.adoc doc: fix self-referential config in sendemail.smtpSSLClientKey 2026-04-16 21:22:01 -07:00
sequencer.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
showbranch.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
sideband.adoc Merge branch 'ta/doc-config-adoc-fixes' 2026-06-17 11:10:11 -07:00
sparse.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
splitindex.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
ssh.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
stash.adoc Merge branch 'dk/stash-apply-index' 2025-10-20 14:12:17 -07:00
status.adoc status: clarify how status.compareBranches deduplicates 2026-03-04 10:13:33 -08:00
submodule.adoc doc: fix grammar errors in submodule description 2026-04-16 21:22:01 -07:00
tag.adoc doc: convert git tag to synopsis style 2025-10-05 16:09:03 -07:00
tar.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
trace2.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
trailer.adoc doc: config: convert trailers section to synopsis style 2026-03-16 15:04:37 -07:00
transfer.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
uploadarchive.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
uploadpack.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
url.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
user.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
versionsort.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
web.adoc doc: use .adoc extension for AsciiDoc files 2025-01-21 12:56:06 -08:00
worktree.adoc doc: convert git worktree to synopsis style 2025-10-05 16:09:03 -07:00