Skip to content

Commit 5e50525

Browse files
stefanbellergitster
authored andcommitted
diff: properly error out when combining multiple pickaxe options
In f506b8e (git log/diff: add -G<regexp> that greps in the patch text, 2010-08-23) we were hesitant to check if the user requests both -S and -G at the same time. Now that the pickaxe family also offers --find-object, which looks slightly more different than the former two, let's add a check that those are not used at the same time. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15af58c commit 5e50525

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

diff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,6 +4123,9 @@ void diff_setup_done(struct diff_options *options)
41234123
if (count > 1)
41244124
die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
41254125

4126+
if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
4127+
die(_("-G, -S and --find-object are mutually exclusive"));
4128+
41264129
/*
41274130
* Most of the time we can say "there are changes"
41284131
* only by checking if there are changed paths, but

diffcore-pickaxe.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ void diffcore_pickaxe(struct diff_options *o)
251251
}
252252
}
253253

254-
/* Might want to warn when both S and G are on; I don't care... */
255254
pickaxe(&diff_queued_diff, o, regexp, kws,
256255
(opts & DIFF_PICKAXE_KIND_G) ? diff_grep : has_changes);
257256

0 commit comments

Comments
 (0)