builtin/apply: introduce 'struct apply_state' to start libifying
commit2fc0f1849bd0d6100719bb53f89f15fbd734157a
authorChristian Couder <christian.couder@gmail.com>
Wed, 11 May 2016 13:16:19 +0000 (11 15:16 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 May 2016 19:21:25 +0000 (12 12:21 -0700)
tree19284f0bdf984f4b06e3e8e4099215be55bfc95d
parentdcde8b3dcd8d4411a2311fa0a93ca4ca3b26d61f
builtin/apply: introduce 'struct apply_state' to start libifying

Currently commands that want to use the apply functionality have to launch
a "git apply" process which can be bad for performance.

Let's start libifying the apply functionality and to do that we first need
to get rid of the global variables in "builtin/apply.c".

This patch introduces "struct apply_state" into which all the previously
global variables will be moved. A new parameter called "state" that is a
pointer to the "apply_state" structure will come at the beginning of the
helper functions that need it and will be passed around the call chain.

To start let's move the "prefix" and "prefix_length" global variables 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>
builtin/apply.c