builtin/apply: make parse_chunk() return a negative integer on error
commitb654b34c1cf877709febb602991f46e7ba0d947d
authorChristian Couder <christian.couder@gmail.com>
Mon, 8 Aug 2016 21:03:03 +0000 (8 23:03 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Aug 2016 19:41:46 +0000 (11 12:41 -0700)
tree90367b55dae0dfcf095b7d6f42790a4a96264869
parent5950851e44fc6f19e9fc9261bac4a61e59fc5121
builtin/apply: make parse_chunk() return a negative integer on error

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

To do that in a compatible manner with the rest of the error handling
in builtin/apply.c, parse_chunk() should return a negative integer
instead of calling die() or exit().

As parse_chunk() is called only by apply_patch() which already
returns either -1 or -128 when an error happened, let's make it also
return -1 or -128.

This makes it compatible with what find_header() and parse_binary()
already return.

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