diff-parseopt: convert -D|--irreversible-delete

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Feb 21, 2019 at 18:16 UTC 1e5332968a0f46978d457ec580bb1c00c48fd13c
1 file changed +4 -4
diff.c
+4 -4
@@ -5060,6 +5060,9 @@ static void prep_parse_options(struct diff_options *options)
5060 N_("detect renames"),
5061 PARSE_OPT_NONEG | PARSE_OPT_OPTARG,
5062 diff_opt_find_renames),
5063 + OPT_SET_INT_F('D', "irreversible-delete", &options->irreversible_delete,
5064 + N_("omit the preimage for deletes"),
5065 + 1, PARSE_OPT_NONEG),
5066
5067 OPT_GROUP(N_("Diff other options")),
5068 { OPTION_CALLBACK, 0, "output", options, N_("<file>"),
@@ -5094,10 +5097,7 @@ int diff_opt_parse(struct diff_options *options,
5097 return ac;
5098
5099 /* renames options */
5097 - if (!strcmp(arg, "-D") || !strcmp(arg, "--irreversible-delete")) {
5098 - options->irreversible_delete = 1;
5099 - }
5100 - else if (starts_with(arg, "-C") ||
5100 + if (starts_with(arg, "-C") ||
5101 skip_to_optional_arg(arg, "--find-copies", NULL)) {
5102 if (options->detect_rename == DIFF_DETECT_COPY)
5103 options->flags.find_copies_harder = 1;