Skip to content

Commit cdc43eb

Browse files
pcloudsgitster
authored andcommitted
diff-parseopt: convert --no-renames|--[no--rename-empty
For --rename-empty, see 90d43b0 (teach diffcore-rename to optionally ignore empty content - 2012-03-22) for more information. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent bdd4741 commit cdc43eb

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Documentation/diff-options.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ endif::git-format-patch[]
392392
Turn off rename detection, even when the configuration
393393
file gives the default to do so.
394394

395+
--[no-]rename-empty::
396+
Whether to use empty blobs as rename source.
397+
395398
ifndef::git-format-patch[]
396399
--check::
397400
Warn if changes introduce conflict markers or whitespace errors.

diff.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5087,6 +5087,11 @@ static void prep_parse_options(struct diff_options *options)
50875087
diff_opt_find_copies),
50885088
OPT_BOOL(0, "find-copies-harder", &options->flags.find_copies_harder,
50895089
N_("use unmodified files as source to find copies")),
5090+
OPT_SET_INT_F(0, "no-renames", &options->detect_rename,
5091+
N_("disable rename detection"),
5092+
0, PARSE_OPT_NONEG),
5093+
OPT_BOOL(0, "rename-empty", &options->flags.rename_empty,
5094+
N_("use empty blobs as rename source")),
50905095

50915096
OPT_GROUP(N_("Diff other options")),
50925097
{ OPTION_CALLBACK, 0, "output", options, N_("<file>"),
@@ -5121,13 +5126,7 @@ int diff_opt_parse(struct diff_options *options,
51215126
return ac;
51225127

51235128
/* renames options */
5124-
if (!strcmp(arg, "--no-renames"))
5125-
options->detect_rename = 0;
5126-
else if (!strcmp(arg, "--rename-empty"))
5127-
options->flags.rename_empty = 1;
5128-
else if (!strcmp(arg, "--no-rename-empty"))
5129-
options->flags.rename_empty = 0;
5130-
else if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) {
5129+
if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) {
51315130
options->flags.relative_name = 1;
51325131
if (arg)
51335132
options->prefix = arg;

0 commit comments

Comments
 (0)