summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2015-05-03 14:29:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-05-06 20:35:48 (GMT)
commit46f034483eb9f88cf79cba8b76f085464287fc58 (patch)
treef36a9f07fddfa5874df41297bdb7ec4dc0c9d46a /cache.h
parent2dfb2e07cb0cb979f630643b57dca579a0359a9d (diff)
downloadgit-46f034483eb9f88cf79cba8b76f085464287fc58.zip
git-46f034483eb9f88cf79cba8b76f085464287fc58.tar.gz
git-46f034483eb9f88cf79cba8b76f085464287fc58.tar.bz2
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>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 3d3244b..38419c3 100644
--- a/cache.h
+++ b/cache.h
@@ -838,6 +838,7 @@ extern int is_ntfs_dotgit(const char *name);
/* object replacement */
#define LOOKUP_REPLACE_OBJECT 1
+#define LOOKUP_UNKNOWN_OBJECT 2
extern void *read_sha1_file_extended(const unsigned char *sha1, enum object_type *type, unsigned long *size, unsigned flag);
static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)
{
@@ -1304,6 +1305,7 @@ struct object_info {
unsigned long *sizep;
unsigned long *disk_sizep;
unsigned char *delta_base_sha1;
+ struct strbuf *typename;
/* Response */
enum {