]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'so/separate-field-for-m-and-diff-merges'
authorJunio C Hamano <gitster@pobox.com>
Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Sep 2020 20:53:07 +0000 (13:53 -0700)
Internal API clean-up to handle two options "diff-index" and "log"
have, which happen to share the same short form, more sensibly.

* so/separate-field-for-m-and-diff-merges:
  revision: add separate field for "-m" of "diff-index -m"

diff-lib.c
revision.c
revision.h

index 50521e2093fc581ce3cedc76b3036a61f31bef35..5d5d3dafab3386920d2c0883d33d06f860f6d11b 100644 (file)
@@ -405,14 +405,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
        /* if the entry is not checked out, don't examine work tree */
        cached = o->index_only ||
                (idx && ((idx->ce_flags & CE_VALID) || ce_skip_worktree(idx)));
-       /*
-        * Backward compatibility wart - "diff-index -m" does
-        * not mean "do not ignore merges", but "match_missing".
-        *
-        * But with the revision flag parsing, that's found in
-        * "!revs->ignore_merges".
-        */
-       match_missing = !revs->ignore_merges;
+
+       match_missing = revs->match_missing;
 
        if (cached && idx && ce_stage(idx)) {
                struct diff_filepair *pair;
index 08c2ad23af668a42cca30a5cebfcc2feee1ce895..0d67b842fd8b14fb6997e0ebfd9113135123b373 100644 (file)
@@ -2352,7 +2352,13 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->diffopt.flags.recursive = 1;
                revs->diffopt.flags.tree_in_recursive = 1;
        } else if (!strcmp(arg, "-m")) {
+               /*
+                * To "diff-index", "-m" means "match missing", and to the "log"
+                * family of commands, it means "show full diff for merges". Set
+                * both fields appropriately.
+                */
                revs->ignore_merges = 0;
+               revs->match_missing = 1;
        } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
                if (!strcmp(optarg, "off")) {
                        revs->ignore_merges = 1;
index c1e5bcf139d7a31d9bf851ada3bc8373f5ab932e..f6bf860d19e5a2997193c25873a5ba82e030f68b 100644 (file)
@@ -188,6 +188,7 @@ struct rev_info {
        unsigned int    diff:1,
                        full_diff:1,
                        show_root_diff:1,
+                       match_missing:1,
                        no_commit_id:1,
                        verbose_header:1,
                        combine_merges:1,