builtin/apply: move 'apply' global into 'struct apply_state'
To libify the apply functionality the 'apply' 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>
maint
Christian Couder9 years agocommitted byJunio C Hamano
@ -2058,7 +2060,7 @@ static int parse_chunk(struct apply_state *state, char *buffer, unsigned long si
@@ -2058,7 +2060,7 @@ static int parse_chunk(struct apply_state *state, char *buffer, unsigned long si
* without metadata change. A binary patch appears
* empty to us here.
*/
if ((apply || state->check) &&
if ((state->apply || state->check) &&
(!patch->is_binary && !metadata_changes(patch)))
die(_("patch with only garbage at line %d"), state_linenr);
}
@ -2916,7 +2918,7 @@ static int apply_one_fragment(struct apply_state *state,
@@ -2916,7 +2918,7 @@ static int apply_one_fragment(struct apply_state *state,
* apply_data->apply_fragments->apply_one_fragment
*/
if (ws_error_action == die_on_ws_error)
apply = 0;
state->apply = 0;
}
if (state->apply_verbosely && applied_pos != pos) {
@ -4460,9 +4462,9 @@ static int apply_patch(struct apply_state *state,
@@ -4460,9 +4462,9 @@ static int apply_patch(struct apply_state *state,
die(_("unrecognized input"));
if (whitespace_error && (ws_error_action == die_on_ws_error))