summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Christian Couder <christian.couder@gmail.com>2016-08-08 23:03:08 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-08-11 12:41:47 -0700
commit2f5a6d1218de4dfa326ff289b784d3e293b8141f (patch)
tree2c77afed2a36432dd3ac9b9b3b9714cfc4024382 /builtin
parentbuiltin/apply: move init_apply_state() to apply.c (diff)
downloadtgif-2f5a6d1218de4dfa326ff289b784d3e293b8141f.tar.xz
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 'builtin')
-rw-r--r--builtin/apply.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index bb6ff77038..61fd316363 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4741,7 +4741,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix)
OPT_END()
};
- init_apply_state(&state, prefix, &lock_file);
+ if (init_apply_state(&state, prefix, &lock_file))
+ exit(128);
argc = parse_options(argc, argv, state.prefix, builtin_apply_options,
apply_usage, 0);