From 5e505257f2651647c072f9c61fdc5dd52bbce8b2 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 4 Jan 2018 14:50:43 -0800 Subject: diff: properly error out when combining multiple pickaxe options In f506b8e8b5 (git log/diff: add -G 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 Signed-off-by: Junio C Hamano --- diff.c | 3 +++ diffcore-pickaxe.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/diff.c b/diff.c index a872bdcac1..42858d4c7d 100644 --- a/diff.c +++ b/diff.c @@ -4123,6 +4123,9 @@ void diff_setup_done(struct diff_options *options) if (count > 1) die(_("--name-only, --name-status, --check and -s are mutually exclusive")); + if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK)) + die(_("-G, -S and --find-object are mutually exclusive")); + /* * Most of the time we can say "there are changes" * only by checking if there are changed paths, but diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 72bb5a9514..239ce5122b 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -251,7 +251,6 @@ void diffcore_pickaxe(struct diff_options *o) } } - /* Might want to warn when both S and G are on; I don't care... */ pickaxe(&diff_queued_diff, o, regexp, kws, (opts & DIFF_PICKAXE_KIND_G) ? diff_grep : has_changes); -- cgit v1.2.1