diff options
author | Christian Couder <christian.couder@gmail.com> | 2016-05-24 10:11:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-01 10:10:16 -0700 |
commit | 1ff36a107f609978dedd8c5b56aad8ca6276f975 (patch) | |
tree | ef74855d71670a1c4bf928c46dad1a201bd02c1e /builtin | |
parent | b12e888f7a9489b964ad266b27d7fcfa62fa78e4 (diff) | |
download | git-1ff36a107f609978dedd8c5b56aad8ca6276f975.tar.gz git-1ff36a107f609978dedd8c5b56aad8ca6276f975.tar.xz |
builtin/apply: move 'no_add' global into 'struct apply_state'
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 <sbeller@google.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/apply.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/apply.c b/builtin/apply.c index d00017baf..604e7bf8f 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -41,6 +41,7 @@ struct apply_state { int apply_in_reverse; int apply_with_reject; int apply_verbosely; + int no_add; int threeway; int unidiff_zero; }; @@ -53,7 +54,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'; @@ -2782,7 +2782,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; @@ -4600,7 +4600,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")), |