doc: clarify documentation for rename/copy limits

A few places in the docs implied that rename/copy detection is always quadratic or that all (unpaired) files were involved in the quadratic portion of rename/copy detection. The following two commits each introduced an exception to this: 9027f53cb505 (Do linear-time/space rename logic for exact renames, 2007-10-25) bd24aa2f97a0 (diffcore-rename: guide inexact rename detection based on basenames, 2021-02-14) (As a side note, for copy detection, the basename guided inexact rename detection is turned off and the exact renames will only result in sources (without the dests) being removed from the set of files used in quadratic detection. So, for copy detection, the documentation was closer to correct.) Avoid implying that all files involved in rename/copy detection are subject to the full quadratic algorithm. While at it, also note the default values for all these settings. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jul 15, 2021 at 00:45 UTC 6623a528e00b73f5438724a355c43343d3de8652
3 files changed +20 -12
Documentation/config/diff.txt
+4 -3
@@ -118,9 +118,10 @@ diff.orderFile::
118 relative to the top of the working tree.
119
120 diff.renameLimit::
121 - The number of files to consider when performing the copy/rename
122 - detection; equivalent to the 'git diff' option `-l`. This setting
123 - has no effect if rename detection is turned off.
121 + The number of files to consider in the exhaustive portion of
122 + copy/rename detection; equivalent to the 'git diff' option
123 + `-l`. If not set, the default value is currently 400. This
124 + setting has no effect if rename detection is turned off.
125
126 diff.renames::
127 Whether and how Git detects renames. If set to "false",
Documentation/config/merge.txt
+6 -4
@@ -33,10 +33,12 @@ merge.verifySignatures::
33 include::fmt-merge-msg.txt[]
34
35 merge.renameLimit::
36 - The number of files to consider when performing rename detection
37 - during a merge; if not specified, defaults to the value of
38 - diff.renameLimit. This setting has no effect if rename detection
39 - is turned off.
36 + The number of files to consider in the exhaustive portion of
37 + rename detection during a merge. If not specified, defaults
38 + to the value of diff.renameLimit. If neither
39 + merge.renameLimit nor diff.renameLimit are specified,
40 + currently defaults to 1000. This setting has no effect if
41 + rename detection is turned off.
42
43 merge.renames::
44 Whether Git detects renames. If set to "false", rename detection
Documentation/diff-options.txt
+10 -5
@@ -588,11 +588,16 @@ When used together with `-B`, omit also the preimage in the deletion part
588 of a delete/create pair.
589
590 -l<num>::
591 - The `-M` and `-C` options require O(n^2) processing time where n
592 - is the number of potential rename/copy targets. This
593 - option prevents rename/copy detection from running if
594 - the number of rename/copy targets exceeds the specified
595 - number.
591 + The `-M` and `-C` options involve some preliminary steps that
592 + can detect subsets of renames/copies cheaply, followed by an
593 + exhaustive fallback portion that compares all remaining
594 + unpaired destinations to all relevant sources. (For renames,
595 + only remaining unpaired sources are relevant; for copies, all
596 + original sources are relevant.) For N sources and
597 + destinations, this exhaustive check is O(N^2). This option
598 + prevents the exhaustive portion of rename/copy detection from
599 + running if the number of source/destination files involved
600 + exceeds the specified number. Defaults to diff.renameLimit.
601
602 ifndef::git-format-patch[]
603 --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::