]> git.ipfire.org Git - thirdparty/git.git/commitdiff
revision: change "--diff-merges" option to require parameter
authorSergey Organov <sorganov@gmail.com>
Wed, 5 Aug 2020 22:08:30 +0000 (01:08 +0300)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Aug 2020 21:20:24 +0000 (14:20 -0700)
--diff-merges=off is the only accepted form for now, a synonym for
--no-diff-merges.

This patch is a preparation for adding more values, as well as supporting
--diff-merges=<parent>, where <parent> is single parent number to output diff
against.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c

index 669bc856694f9853b4067eb2027da4522fd6112e..417659cfcb100be4a9e0646ceabacd5ae1d2e57d 100644 (file)
@@ -2323,8 +2323,15 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->diff = 1;
                revs->diffopt.flags.recursive = 1;
                revs->diffopt.flags.tree_in_recursive = 1;
-       } else if (!strcmp(arg, "-m") || !strcmp(arg, "--diff-merges")) {
+       } else if (!strcmp(arg, "-m")) {
                revs->ignore_merges = 0;
+       } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
+               if (!strcmp(optarg, "off")) {
+                       revs->ignore_merges = 1;
+               } else {
+                       die(_("unknown value for --diff-merges: %s"), optarg);
+               }
+               return argcount;
        } else if (!strcmp(arg, "--no-diff-merges")) {
                revs->ignore_merges = 1;
        } else if (!strcmp(arg, "-c")) {