Re: [RFC PATCH 2/2] object-file API: have unpack_loose_header() return "int" again
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> +int unpack_loose_header(git_zstream *stream, unsigned char *map,
> + unsigned long mapsize, void *buffer,
> + unsigned long bufsiz, struct strbuf *header);
Simpler is better as long as we don't make it too simple ;-)
> if (!header)
> - return ULHR_TOO_LONG;
> + return error(_("header too long, exceeds %d bytes"),
> + MAX_HEADER_LEN);> - return ULHR_BAD;
> + return error(_("could not find end of corrupt long header"));
> }Show 21 quoted lines
> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
> index dadf3b14583..d742697d3bf 100755
> --- a/t/t1006-cat-file.sh
> +++ b/t/t1006-cat-file.sh
> @@ -536,12 +536,14 @@ do
> if test "$arg2" = "-p"
> then
> cat >expect <<-EOF
> - error: header for $bogus_long_sha1 too long, exceeds 32 bytes
> + error: header too long, exceeds 32 bytes
> + error: unable to unpack $bogus_long_sha1 header
> fatal: Not a valid object name $bogus_long_sha1
> EOF
> else
> cat >expect <<-EOF
> - error: header for $bogus_long_sha1 too long, exceeds 32 bytes
> + error: header too long, exceeds 32 bytes
> + error: unable to unpack $bogus_long_sha1 header
> fatal: git cat-file: could not get object info
> EOF
> fi &&