Skip to content

Commit c1ce30d

Browse files
committed
Merge branch 'so/separate-field-for-m-and-diff-merges'
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"
2 parents eb7460f + 572fc9a commit c1ce30d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

diff-lib.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
405405
/* if the entry is not checked out, don't examine work tree */
406406
cached = o->index_only ||
407407
(idx && ((idx->ce_flags & CE_VALID) || ce_skip_worktree(idx)));
408-
/*
409-
* Backward compatibility wart - "diff-index -m" does
410-
* not mean "do not ignore merges", but "match_missing".
411-
*
412-
* But with the revision flag parsing, that's found in
413-
* "!revs->ignore_merges".
414-
*/
415-
match_missing = !revs->ignore_merges;
408+
409+
match_missing = revs->match_missing;
416410

417411
if (cached && idx && ce_stage(idx)) {
418412
struct diff_filepair *pair;

revision.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,13 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
23522352
revs->diffopt.flags.recursive = 1;
23532353
revs->diffopt.flags.tree_in_recursive = 1;
23542354
} else if (!strcmp(arg, "-m")) {
2355+
/*
2356+
* To "diff-index", "-m" means "match missing", and to the "log"
2357+
* family of commands, it means "show full diff for merges". Set
2358+
* both fields appropriately.
2359+
*/
23552360
revs->ignore_merges = 0;
2361+
revs->match_missing = 1;
23562362
} else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
23572363
if (!strcmp(optarg, "off")) {
23582364
revs->ignore_merges = 1;

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ struct rev_info {
188188
unsigned int diff:1,
189189
full_diff:1,
190190
show_root_diff:1,
191+
match_missing:1,
191192
no_commit_id:1,
192193
verbose_header:1,
193194
combine_merges:1,

0 commit comments

Comments
 (0)