[PATCH v2 23/94] builtin/apply: move 'no_add' global into 'struct apply_state'
From: Christian Couder <hidden>
Date: 2016-06-16 02:19:19
Subsystem:
the rest · Maintainer:
Linus Torvalds
To libify the apply functionality the 'no_add' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <redacted> Signed-off-by: Christian Couder <redacted> --- builtin/apply.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 3650922..d699cd9 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c@@ -41,6 +41,7 @@ struct apply_state { int summary; int threeway; + int no_add; /* * --check turns on checking that the working tree matches the
@@ -63,7 +64,6 @@ static int newfd = -1; static int state_p_value = 1; static int p_value_known; static int apply = 1; -static int no_add; static int unsafe_paths; static const char *fake_ancestor; static int line_termination = '\n';
@@ -2792,7 +2792,7 @@ static int apply_one_fragment(struct apply_state *state, /* Fall-through for ' ' */ case '+': /* --no-add does not add new lines */ - if (first == '+' && no_add) + if (first == '+' && state->no_add) break; start = newlines.len;
@@ -4605,7 +4605,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) { OPTION_CALLBACK, 'p', NULL, NULL, N_("num"), N_("remove <num> leading slashes from traditional diff paths"), 0, option_parse_p }, - OPT_BOOL(0, "no-add", &no_add, + OPT_BOOL(0, "no-add", &state.no_add, N_("ignore additions made by the patch")), OPT_BOOL(0, "stat", &state.diffstat, N_("instead of applying the patch, output diffstat for the input")),
--
2.8.2.490.g3dabe57