Skip to content

Commit bfff2c4

Browse files
avargitster
authored andcommitted
object-file.c: return -1, not "status" from unpack_loose_header()
Return a -1 when git_inflate() fails instead of whatever Z_* status we'd get from zlib.c. This makes no difference to any error we report, but makes it more obvious that we don't care about the specific zlib error codes here. See d21f842 (unpack_sha1_header(): detect malformed object header, 2016-09-25) for the commit that added the "return status" code. As far as I can tell there was never a real reason (e.g. different reporting) for carrying down the "status" as opposed to "-1". At the time that d21f842 was written there was a corresponding "ret < Z_OK" check right after the unpack_sha1_header() call (the "unpack_sha1_header()" function was later rename to our current "unpack_loose_header()"). However, that check was removed in c84a1f3 (sha1_file: refactor read_object, 2017-06-21) without changing the corresponding return code. So let's do the minor cleanup of also changing this function to return a -1. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 74ad250 commit bfff2c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

object-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ int unpack_loose_header(git_zstream *stream,
12391239
buffer, bufsiz);
12401240

12411241
if (status < Z_OK)
1242-
return status;
1242+
return -1;
12431243

12441244
/* Make sure we have the terminating NUL */
12451245
if (!memchr(buffer, '\0', stream->next_out - (unsigned char *)buffer))

0 commit comments

Comments
 (0)