am: avoid diff_opt_parse()

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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2019-03-24 15:20:14 +07:00
committed by Junio C Hamano
parent 16bb3d714d
commit cdb5330a9b
3 changed files with 10 additions and 2 deletions

2
diff.h
View File

@ -233,6 +233,8 @@ struct diff_options {
struct option *parseopts;
};
unsigned diff_filter_bit(char status);
void diff_emit_submodule_del(struct diff_options *o, const char *line);
void diff_emit_submodule_add(struct diff_options *o, const char *line);
void diff_emit_submodule_untracked(struct diff_options *o, const char *path);