From 16bb3d714dcb1bf50f7f96b957c4306dc6df137e 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:13 +0700 Subject: diff --no-index: use parse_options() instead of diff_opt_parse() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While at there, move exit() back to the caller. It's easier to see the flow that way than burying it in diff-no-index.c Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'diff.h') diff --git a/diff.h b/diff.h index d9ad73f0e1..03c6afda22 100644 --- a/diff.h +++ b/diff.h @@ -437,7 +437,8 @@ int diff_flush_patch_id(struct diff_options *, struct object_id *, int); int diff_result_code(struct diff_options *, int); -void diff_no_index(struct repository *, struct rev_info *, int, const char **); +int diff_no_index(struct repository *, struct rev_info *, + int implicit_no_index, int, const char **); int index_differs_from(struct repository *r, const char *def, const struct diff_flags *flags, -- cgit v1.2.3 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.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'diff.h') diff --git a/diff.h b/diff.h index 03c6afda22..f88482705c 100644 --- a/diff.h +++ b/diff.h @@ -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); -- cgit v1.2.3