From cdb5330a9baa64c28473fb0f446ca2242d6971fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sun, 24 Mar 2019 15:20:14 +0700 Subject: am: avoid diff_opt_parse() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff_opt_parse() is a heavy hammer to just set diff filter. But it's the only way because of the diff_status_letters[] mapping. Add a new API to set diff filter and use it in git-am. diff_opt_parse()'s only remaining call site in revision.c will be gone soon and having it here just because of git-am does not make sense. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'diff.c') diff --git a/diff.c b/diff.c index 8b770cd396..11f26285c3 100644 --- a/diff.c +++ b/diff.c @@ -4692,6 +4692,12 @@ static unsigned filter_bit_tst(char status, const struct diff_options *opt) return opt->filter & filter_bit[(int) status]; } +unsigned diff_filter_bit(char status) +{ + prepare_filter_bits(); + return filter_bit[(int) status]; +} + static int diff_opt_diff_filter(const struct option *option, const char *optarg, int unset) { -- cgit v1.2.3