diff: reject unknown change class given to --diff-filter
authorJunio C Hamano <gitster@pobox.com>
Wed, 17 Jul 2013 22:27:19 +0000 (15:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Jul 2013 23:24:14 +0000 (16:24 -0700)
We used to accept "git diff --diff-filter=Q" (note that there is no
such change class 'Q') silently and showed no output (because there
is no such change class 'Q').

Error out when such an input is given.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff --git a/diff.c b/diff.c
index 03f10e65163450ed214497ef542a1f6fa0d02392..3d37b567781ef1231ef1aa1bd7a89d4d58875a2e 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3537,7 +3537,7 @@ static int parse_diff_filter_opt(const char *optarg, struct diff_options *opt)
 
                bit = (0 <= optch && optch <= 'Z') ? filter_bit[optch] : 0;
                if (!bit)
-                       continue; /* ignore unknown ones, like we always have */
+                       return optarg[i];
                opt->filter |= bit;
        }
        return 0;