• J
    fsck: detect trailing garbage in all object types · cce044df
    Jeff King 提交于
    When a loose tree or commit is read by fsck (or any git
    program), unpack_sha1_rest() checks whether there is extra
    cruft at the end of the object file, after the zlib data.
    Blobs that are streamed, however, do not have this check.
    
    For normal git operations, it's not a big deal. We know the
    sha1 and size checked out, so we have the object bytes we
    wanted.  The trailing garbage doesn't affect what we're
    trying to do.
    
    But since the point of fsck is to find corruption or other
    problems, it should be more thorough. This patch teaches its
    loose-sha1 reader to detect extra bytes after the zlib
    stream and complain.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    cce044df
sha1_file.c 97.0 KB