]> granicus.if.org Git - git/commitdiff
diff-parseopt: convert --no-renames|--[no--rename-empty
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 21 Feb 2019 11:16:18 +0000 (18:16 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Feb 2019 23:16:59 +0000 (15:16 -0800)
For --rename-empty, see 90d43b0768 (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>
Documentation/diff-options.txt
diff.c

index 56b731eae54410cc000d2ed99573ed482ac4bfb6..915f2fec8b1d4cf08e0fef1c4ae2eb8e43969e21 100644 (file)
@@ -392,6 +392,9 @@ endif::git-format-patch[]
        Turn off rename detection, even when the configuration
        file gives the default to do so.
 
+--[no-]rename-empty::
+       Whether to use empty blobs as rename source.
+
 ifndef::git-format-patch[]
 --check::
        Warn if changes introduce conflict markers or whitespace errors.
diff --git a/diff.c b/diff.c
index abb1566f95711382637b713c413d7098665b562d..d423a06b41b1c3bf362ea7601df80ed9dea1a102 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -5087,6 +5087,11 @@ static void prep_parse_options(struct diff_options *options)
                               diff_opt_find_copies),
                OPT_BOOL(0, "find-copies-harder", &options->flags.find_copies_harder,
                         N_("use unmodified files as source to find copies")),
+               OPT_SET_INT_F(0, "no-renames", &options->detect_rename,
+                             N_("disable rename detection"),
+                             0, PARSE_OPT_NONEG),
+               OPT_BOOL(0, "rename-empty", &options->flags.rename_empty,
+                        N_("use empty blobs as rename source")),
 
                OPT_GROUP(N_("Diff other options")),
                { OPTION_CALLBACK, 0, "output", options, N_("<file>"),
@@ -5121,13 +5126,7 @@ int diff_opt_parse(struct diff_options *options,
                return ac;
 
        /* renames options */
-       if (!strcmp(arg, "--no-renames"))
-               options->detect_rename = 0;
-       else if (!strcmp(arg, "--rename-empty"))
-               options->flags.rename_empty = 1;
-       else if (!strcmp(arg, "--no-rename-empty"))
-               options->flags.rename_empty = 0;
-       else if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) {
+       if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) {
                options->flags.relative_name = 1;
                if (arg)
                        options->prefix = arg;