apply: make init_apply_state() return -1 instead of exit()ing
[gitweb.git] / apply.c
diff --git a/apply.c b/apply.c
index c858ca4be9aab155a280d659b134fab8f98c2fab..6e0e9928396b0f86ed52d411aa455ead3a390621 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -55,9 +55,9 @@ int parse_ignorewhitespace_option(struct apply_state *state,
        return error(_("unrecognized whitespace ignore option '%s'"), option);
 }
 
-void init_apply_state(struct apply_state *state,
-                     const char *prefix,
-                     struct lock_file *lock_file)
+int init_apply_state(struct apply_state *state,
+                    const char *prefix,
+                    struct lock_file *lock_file)
 {
        memset(state, 0, sizeof(*state));
        state->prefix = prefix;
@@ -79,9 +79,10 @@ void init_apply_state(struct apply_state *state,
 
        git_apply_config();
        if (apply_default_whitespace && parse_whitespace_option(state, apply_default_whitespace))
-               exit(1);
+               return -1;
        if (apply_default_ignorewhitespace && parse_ignorewhitespace_option(state, apply_default_ignorewhitespace))
-               exit(1);
+               return -1;
+       return 0;
 }
 
 void clear_apply_state(struct apply_state *state)