diff options
author | Christian Couder <christian.couder@gmail.com> | 2016-08-08 23:03:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-11 12:41:47 -0700 |
commit | 2f5a6d1218de4dfa326ff289b784d3e293b8141f (patch) | |
tree | 2c77afed2a36432dd3ac9b9b3b9714cfc4024382 /apply.c | |
parent | bb493a5c147a4b60f0f412a71bf9236ede4a560c (diff) | |
download | git-2f5a6d1218de4dfa326ff289b784d3e293b8141f.tar.gz |
apply: make init_apply_state() return -1 instead of exit()ing
To libify `git apply` functionality we have to signal errors to the
caller instead of exit()ing.
To do that in a compatible manner with the rest of the error handling
in "builtin/apply.c", init_apply_state() should return -1 instead of
calling exit().
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'apply.c')
-rw-r--r-- | apply.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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) |