To libify the apply functionality the 'has_include' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

Reviewed-by: Stefan Beller <sbel...@google.com>
Signed-off-by: Christian Couder <chrisc...@tuxfamily.org>
---
 builtin/apply.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 14bbcc2..f2ee8bf 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -46,6 +46,7 @@ struct apply_state {
        const char *fake_ancestor;
        const char *patch_input_file;
        struct string_list limit_by_name;
+       int has_include;
 
        /*
         *  --check turns on checking that the working tree matches the
@@ -1968,7 +1969,6 @@ static void prefix_patch(struct apply_state *state, 
struct patch *p)
  * include/exclude
  */
 
-static int has_include;
 static void add_name_limit(struct apply_state *state,
                           const char *name,
                           int exclude)
@@ -2004,7 +2004,7 @@ static int use_patch(struct apply_state *state, struct 
patch *p)
         * not used.  Otherwise, we saw bunch of exclude rules (or none)
         * and such a path is used.
         */
-       return !has_include;
+       return !state->has_include;
 }
 
 
@@ -4541,7 +4541,7 @@ static int option_parse_include(const struct option *opt,
 {
        struct apply_state *state = opt->value;
        add_name_limit(state, arg, 0);
-       has_include = 1;
+       state->has_include = 1;
        return 0;
 }
 
-- 
2.8.2.490.g3dabe57

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to