builtin/apply: make apply_patch() return -1 or -128 instead of die()ing
commitf07a9f7643c8b261b5d03d9c288c44916277f05e
authorChristian Couder <christian.couder@gmail.com>
Mon, 8 Aug 2016 21:03:00 +0000 (8 23:03 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Aug 2016 19:41:46 +0000 (11 12:41 -0700)
tree1c15ccf83418f8500be662840e237daf9dd88caf
parent71501a71d0431ade410afa618adf55806e1f5f11
builtin/apply: make apply_patch() return -1 or -128 instead of die()ing

To libify `git apply` functionality we have to signal errors
to the caller instead of die()ing.

As a first step in this direction, let's make apply_patch() return
-1 or -128 in case of errors instead of dying. For now its only
caller apply_all_patches() will exit(128) when apply_patch()
return -128 and it will exit(1) when it returns -1.

We exit() with code 128 because that was what die() was doing
and we want to keep the distinction between exiting with code 1
and exiting with code 128.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/apply.c