diff-parseopt: convert --[no-]minimal
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 21 Feb 2019 11:16:20 +0000 (18:16 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Feb 2019 23:16:59 +0000 (15:16 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff --git a/diff.c b/diff.c
index b9c267a19977061ebeaf0678fd219247e02bbb9b..33492e754fc5b220faa18adfb8a0f909e1d70245 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -5105,6 +5105,11 @@ static void prep_parse_options(struct diff_options *options)
                OPT_BOOL(0, "rename-empty", &options->flags.rename_empty,
                         N_("use empty blobs as rename source")),
 
+               OPT_GROUP(N_("Diff algorithm options")),
+               OPT_BIT(0, "minimal", &options->xdl_opts,
+                       N_("produce the smallest possible diff"),
+                       XDF_NEED_MINIMAL),
+
                OPT_GROUP(N_("Diff other options")),
                OPT_CALLBACK_F(0, "relative", options, N_("<prefix>"),
                               N_("when run from subdir, exclude changes outside and show relative paths"),
@@ -5142,11 +5147,7 @@ int diff_opt_parse(struct diff_options *options,
                return ac;
 
        /* xdiff options */
-       if (!strcmp(arg, "--minimal"))
-               DIFF_XDL_SET(options, NEED_MINIMAL);
-       else if (!strcmp(arg, "--no-minimal"))
-               DIFF_XDL_CLR(options, NEED_MINIMAL);
-       else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
+       if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
                DIFF_XDL_SET(options, IGNORE_WHITESPACE);
        else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
                DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE);