]> git.ipfire.org Git - thirdparty/git.git/commit - sha1_file.c
sha1_file: support reading from a loose object of unknown type
authorKarthik Nayak <karthik.188@gmail.com>
Sun, 3 May 2015 14:29:59 +0000 (19:59 +0530)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 May 2015 20:35:48 +0000 (13:35 -0700)
commit46f034483eb9f88cf79cba8b76f085464287fc58
treef36a9f07fddfa5874df41297bdb7ec4dc0c9d46a
parent2dfb2e07cb0cb979f630643b57dca579a0359a9d
sha1_file: support reading from a loose object of unknown type

Update sha1_loose_object_info() to optionally allow it to read
from a loose object file of unknown/bogus type; as the function
usually returns the type of the object it read in the form of enum
for known types, add an optional "typename" field to receive the
name of the type in textual form and a flag to indicate the reading
of a loose object file of unknown/bogus type.

Add parse_sha1_header_extended() which acts as a wrapper around
parse_sha1_header() allowing more information to be obtained.

Add unpack_sha1_header_to_strbuf() to unpack sha1 headers of
unknown/corrupt objects which have a unknown sha1 header size to
a strbuf structure. This was written by Junio C Hamano but tested
by me.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Hepled-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
sha1_file.c