Teach diff to imply --find-copies-harder upon -C -C
Earlier, a second "-C" on the command line had no effect. But "--find-copies-harder" is so long to type, let's make doubled -C enable that option. It is in line with how "git blame" handles such doubled options to mean "work harder". Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d52fd42acd
commit
ca6c097089
@ -86,7 +86,7 @@
|
|||||||
Detect renames.
|
Detect renames.
|
||||||
|
|
||||||
-C::
|
-C::
|
||||||
Detect copies as well as renames.
|
Detect copies as well as renames. See also `--find-copies-harder`.
|
||||||
|
|
||||||
--diff-filter=[ACDMRTUXB*]::
|
--diff-filter=[ACDMRTUXB*]::
|
||||||
Select only files that are Added (`A`), Copied (`C`),
|
Select only files that are Added (`A`), Copied (`C`),
|
||||||
@ -100,12 +100,13 @@
|
|||||||
that matches other criteria, nothing is selected.
|
that matches other criteria, nothing is selected.
|
||||||
|
|
||||||
--find-copies-harder::
|
--find-copies-harder::
|
||||||
For performance reasons, by default, -C option finds copies only
|
For performance reasons, by default, `-C` option finds copies only
|
||||||
if the original file of the copy was modified in the same
|
if the original file of the copy was modified in the same
|
||||||
changeset. This flag makes the command
|
changeset. This flag makes the command
|
||||||
inspect unmodified files as candidates for the source of
|
inspect unmodified files as candidates for the source of
|
||||||
copy. This is a very expensive operation for large
|
copy. This is a very expensive operation for large
|
||||||
projects, so use it with caution.
|
projects, so use it with caution. Giving more than one
|
||||||
|
`-C` option has the same effect.
|
||||||
|
|
||||||
-l<num>::
|
-l<num>::
|
||||||
-M and -C options require O(n^2) processing time where n
|
-M and -C options require O(n^2) processing time where n
|
||||||
|
2
diff.c
2
diff.c
@ -2201,6 +2201,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
|
|||||||
options->detect_rename = DIFF_DETECT_RENAME;
|
options->detect_rename = DIFF_DETECT_RENAME;
|
||||||
}
|
}
|
||||||
else if (!prefixcmp(arg, "-C")) {
|
else if (!prefixcmp(arg, "-C")) {
|
||||||
|
if (options->detect_rename == DIFF_DETECT_COPY)
|
||||||
|
options->find_copies_harder = 1;
|
||||||
if ((options->rename_score =
|
if ((options->rename_score =
|
||||||
diff_scoreopt_parse(arg)) == -1)
|
diff_scoreopt_parse(arg)) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user