Signed-off-by: Christian Couder <chrisc...@tuxfamily.org>
---
 apply.c         | 7 ++++---
 apply.h         | 2 +-
 builtin/apply.c | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/apply.c b/apply.c
index 9c5f258..11bec48 100644
--- a/apply.c
+++ b/apply.c
@@ -56,7 +56,7 @@ 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)
+int init_apply_state(struct apply_state *state, const char *prefix)
 {
        memset(state, 0, sizeof(*state));
        state->prefix = prefix;
@@ -73,8 +73,9 @@ void init_apply_state(struct apply_state *state, const char 
*prefix)
 
        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;
 }
 
diff --git a/apply.h b/apply.h
index 70ab658..021e9e3 100644
--- a/apply.h
+++ b/apply.h
@@ -126,7 +126,7 @@ extern int parse_whitespace_option(struct apply_state 
*state,
 extern int parse_ignorewhitespace_option(struct apply_state *state,
                                         const char *option);
 
-extern void init_apply_state(struct apply_state *state, const char *prefix);
+extern int init_apply_state(struct apply_state *state, const char *prefix);
 
 
 #endif
diff --git a/builtin/apply.c b/builtin/apply.c
index 1d958fa..e3ee199 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4717,7 +4717,8 @@ int cmd_apply(int argc, const char **argv, const char 
*prefix)
                OPT_END()
        };
 
-       init_apply_state(&state, prefix);
+       if (init_apply_state(&state, prefix))
+               exit(1);
 
        argc = parse_options(argc, argv, state.prefix, builtin_apply_options,
                        apply_usage, 0);
-- 
2.8.1.300.g5fed0c0

--
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