Skip to content

Commit 6623a52

Browse files
newrengitster
authored andcommitted
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: 9027f53 (Do linear-time/space rename logic for exact renames, 2007-10-25) bd24aa2 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05d2c61 commit 6623a52

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

Documentation/config/diff.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ diff.orderFile::
118118
relative to the top of the working tree.
119119

120120
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.
124125

125126
diff.renames::
126127
Whether and how Git detects renames. If set to "false",

Documentation/config/merge.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ merge.verifySignatures::
3333
include::fmt-merge-msg.txt[]
3434

3535
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.
4042

4143
merge.renames::
4244
Whether Git detects renames. If set to "false", rename detection

Documentation/diff-options.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,16 @@ When used together with `-B`, omit also the preimage in the deletion part
588588
of a delete/create pair.
589589

590590
-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.
596601

597602
ifndef::git-format-patch[]
598603
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::

0 commit comments

Comments
 (0)