{"thread":{"id":"39225","subject":"[PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","startedAt":"2015-05-03T14:28:36Z","lastAt":"2015-05-07T18:35:53Z","messageCount":22,"participants":["karthik nayak","Karthik Nayak","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":10,"patchTotal":4},"messages":[{"id":"260460","messageId":"55463094.9040204@gmail.com","threadId":"39225","inReplyTo":null,"subject":"[PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"karthik nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-03T14:28:36Z","receivedAt":"2015-05-03T14:28:36Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Version 9 of this patch series can be found here :\nhttp://thread.gmane.org/gmane.comp.version-control.git/267960\n\nChanges made :\n\n* fold the documentation commit with the previous commit.\n* Increase test coverage to check for large header types.\n* Add a status check in sha1_loose_object_info().\n* Grammatical changes.\n\nThanks to Junio, Eric, Phil for suggestions on v9.\n"},{"id":"260461","messageId":"1430663402-26717-1-git-send-email-karthik.188@gmail.com","threadId":"39225","inReplyTo":"55463094.9040204@gmail.com","subject":"[PATCH v10 1/4] sha1_file: support reading from a loose object of unknown type","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-03T14:29:59Z","receivedAt":"2015-05-03T14:29:59Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Update sha1_loose_object_info() to optionally allow it to read\nfrom a loose object file of unknown/bogus type; as the function\nusually returns the type of the object it read in the form of enum\nfor known types, add an optional \"typename\" field to receive the\nname of the type in textual form and a flag to indicate the reading\nof a loose object file of unknown/bogus type.\n\nAdd parse_sha1_header_extended() which acts as a wrapper around\nparse_sha1_header() allowing more information to be obtained.\n\nAdd unpack_sha1_header_to_strbuf() to unpack sha1 headers of\nunknown/corrupt objects which have a unknown sha1 header size to\na strbuf structure. This was written by Junio C Hamano but tested\nby me.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nHelped-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\nHepled-by: Jeff King <peff@peff.net>\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n cache.h     |   2 +\n sha1_file.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++-----------\n 2 files changed, 101 insertions(+), 22 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 3d3244b..38419c3 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -838,6 +838,7 @@ extern int is_ntfs_dotgit(const char *name);\n \n /* object replacement */\n #define LOOKUP_REPLACE_OBJECT 1\n+#define LOOKUP_UNKNOWN_OBJECT 2\n extern void *read_sha1_file_extended(const unsigned char *sha1, enum object_type *type, unsigned long *size, unsigned flag);\n static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)\n {\n@@ -1304,6 +1305,7 @@ struct object_info {\n \tunsigned long *sizep;\n \tunsigned long *disk_sizep;\n \tunsigned char *delta_base_sha1;\n+\tstruct strbuf *typename;\n \n \t/* Response */\n \tenum {\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 88f06ba..f65bf90 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1564,6 +1564,33 @@ int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long ma\n \treturn git_inflate(stream, 0);\n }\n \n+static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n+\t\t\t\t\tunsigned long mapsize, void *buffer,\n+\t\t\t\t\tunsigned long bufsiz, struct strbuf *header)\n+{\n+\tunsigned char *cp;\n+\tint status;\n+\n+\tstatus = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n+\n+\t/*\n+\t * Check if entire header is unpacked in the first iteration.\n+\t */\n+\tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n+\t\treturn 0;\n+\n+\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n+\tdo {\n+\t\tstatus = git_inflate(stream, 0);\n+\t\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n+\t\tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n+\t\t\treturn 0;\n+\t\tstream->next_out = buffer;\n+\t\tstream->avail_out = bufsiz;\n+\t} while (status != Z_STREAM_END);\n+\treturn -1;\n+}\n+\n static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long size, const unsigned char *sha1)\n {\n \tint bytes = strlen(buffer) + 1;\n@@ -1614,27 +1641,38 @@ static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long s\n  * too permissive for what we want to check. So do an anal\n  * object header parse by hand.\n  */\n-int parse_sha1_header(const char *hdr, unsigned long *sizep)\n+static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,\n+\t\t\t       unsigned int flags)\n {\n-\tchar type[10];\n-\tint i;\n+\tconst char *type_buf = hdr;\n \tunsigned long size;\n+\tint type, type_len = 0;\n \n \t/*\n-\t * The type can be at most ten bytes (including the\n-\t * terminating '\\0' that we add), and is followed by\n+\t * The type can be of any size but is followed by\n \t * a space.\n \t */\n-\ti = 0;\n \tfor (;;) {\n \t\tchar c = *hdr++;\n \t\tif (c == ' ')\n \t\t\tbreak;\n-\t\ttype[i++] = c;\n-\t\tif (i >= sizeof(type))\n-\t\t\treturn -1;\n+\t\ttype_len++;\n \t}\n-\ttype[i] = 0;\n+\n+\ttype = type_from_string_gently(type_buf, type_len, 1);\n+\tif (oi->typename)\n+\t\tstrbuf_add(oi->typename, type_buf, type_len);\n+\t/*\n+\t * Set type to 0 if its an unknown object and\n+\t * we're obtaining the type using '--allow-unkown-type'\n+\t * option.\n+\t */\n+\tif ((flags & LOOKUP_UNKNOWN_OBJECT) && (type < 0))\n+\t\ttype = 0;\n+\telse if (type < 0)\n+\t\tdie(\"invalid object type\");\n+\tif (oi->typep)\n+\t\t*oi->typep = type;\n \n \t/*\n \t * The length must follow immediately, and be in canonical\n@@ -1652,12 +1690,24 @@ int parse_sha1_header(const char *hdr, unsigned long *sizep)\n \t\t\tsize = size * 10 + c;\n \t\t}\n \t}\n-\t*sizep = size;\n+\n+\tif (oi->sizep)\n+\t\t*oi->sizep = size;\n \n \t/*\n \t * The length must be followed by a zero byte\n \t */\n-\treturn *hdr ? -1 : type_from_string(type);\n+\treturn *hdr ? -1 : type;\n+}\n+\n+int parse_sha1_header(const char *hdr, unsigned long *sizep)\n+{\n+\tstruct object_info oi;\n+\n+\toi.sizep = sizep;\n+\toi.typename = NULL;\n+\toi.typep = NULL;\n+\treturn parse_sha1_header_extended(hdr, &oi, LOOKUP_REPLACE_OBJECT);\n }\n \n static void *unpack_sha1_file(void *map, unsigned long mapsize, enum object_type *type, unsigned long *size, const unsigned char *sha1)\n@@ -2524,13 +2574,15 @@ struct packed_git *find_sha1_pack(const unsigned char *sha1,\n }\n \n static int sha1_loose_object_info(const unsigned char *sha1,\n-\t\t\t\t  struct object_info *oi)\n+\t\t\t\t  struct object_info *oi,\n+\t\t\t\t  int flags)\n {\n-\tint status;\n-\tunsigned long mapsize, size;\n+\tint status = 0;\n+\tunsigned long mapsize;\n \tvoid *map;\n \tgit_zstream stream;\n \tchar hdr[32];\n+\tstruct strbuf hdrbuf = STRBUF_INIT;\n \n \tif (oi->delta_base_sha1)\n \t\thashclr(oi->delta_base_sha1);\n@@ -2543,7 +2595,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,\n \t * return value implicitly indicates whether the\n \t * object even exists.\n \t */\n-\tif (!oi->typep && !oi->sizep) {\n+\tif (!oi->typep && !oi->typename && !oi->sizep) {\n \t\tstruct stat st;\n \t\tif (stat_sha1_file(sha1, &st) < 0)\n \t\t\treturn -1;\n@@ -2557,17 +2609,26 @@ static int sha1_loose_object_info(const unsigned char *sha1,\n \t\treturn -1;\n \tif (oi->disk_sizep)\n \t\t*oi->disk_sizep = mapsize;\n-\tif (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0)\n+\tif ((flags & LOOKUP_UNKNOWN_OBJECT)) {\n+\t\tif (unpack_sha1_header_to_strbuf(&stream, map, mapsize, hdr, sizeof(hdr), &hdrbuf) < 0)\n+\t\t\tstatus = error(\"unable to unpack %s header with --allow-unknown-type\",\n+\t\t\t\t       sha1_to_hex(sha1));\n+\t} else if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0)\n \t\tstatus = error(\"unable to unpack %s header\",\n \t\t\t       sha1_to_hex(sha1));\n-\telse if ((status = parse_sha1_header(hdr, &size)) < 0)\n+\tif (status < 0)\n+\t\t; /* Do nothing */\n+\telse if (hdrbuf.len) {\n+\t\tif ((status = parse_sha1_header_extended(hdrbuf.buf, oi, flags)) < 0)\n+\t\t\tstatus = error(\"unable to parse %s header with --allow-unknown-type\",\n+\t\t\t\t       sha1_to_hex(sha1));\n+\t} else if ((status = parse_sha1_header_extended(hdr, oi, flags)) < 0)\n \t\tstatus = error(\"unable to parse %s header\", sha1_to_hex(sha1));\n-\telse if (oi->sizep)\n-\t\t*oi->sizep = size;\n \tgit_inflate_end(&stream);\n \tmunmap(map, mapsize);\n-\tif (oi->typep)\n+\tif (status && oi->typep)\n \t\t*oi->typep = status;\n+\tstrbuf_release(&hdrbuf);\n \treturn 0;\n }\n \n@@ -2576,6 +2637,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \tstruct cached_object *co;\n \tstruct pack_entry e;\n \tint rtype;\n+\tenum object_type real_type;\n \tconst unsigned char *real = lookup_replace_object_extended(sha1, flags);\n \n \tco = find_cached_object(real);\n@@ -2588,13 +2650,15 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\t*(oi->disk_sizep) = 0;\n \t\tif (oi->delta_base_sha1)\n \t\t\thashclr(oi->delta_base_sha1);\n+\t\tif (oi->typename)\n+\t\t\tstrbuf_addstr(oi->typename, typename(co->type));\n \t\toi->whence = OI_CACHED;\n \t\treturn 0;\n \t}\n \n \tif (!find_pack_entry(real, &e)) {\n \t\t/* Most likely it's a loose object. */\n-\t\tif (!sha1_loose_object_info(real, oi)) {\n+\t\tif (!sha1_loose_object_info(real, oi, flags)) {\n \t\t\toi->whence = OI_LOOSE;\n \t\t\treturn 0;\n \t\t}\n@@ -2605,9 +2669,18 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\t\treturn -1;\n \t}\n \n+\t/*\n+\t * packed_object_info() does not follow the delta chain to\n+\t * find out the real type, unless it is given oi->typep.\n+\t */\n+\tif (oi->typename && !oi->typep)\n+\t\toi->typep = &real_type;\n+\n \trtype = packed_object_info(e.p, e.offset, oi);\n \tif (rtype < 0) {\n \t\tmark_bad_packed_object(e.p, real);\n+\t\tif (oi->typep == &real_type)\n+\t\t\toi->typep = NULL;\n \t\treturn sha1_object_info_extended(real, oi, 0);\n \t} else if (in_delta_base_cache(e.p, e.offset)) {\n \t\toi->whence = OI_DBCACHED;\n@@ -2618,6 +2691,10 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,\n \t\toi->u.packed.is_delta = (rtype == OBJ_REF_DELTA ||\n \t\t\t\t\t rtype == OBJ_OFS_DELTA);\n \t}\n+\tif (oi->typename)\n+\t\tstrbuf_addstr(oi->typename, typename(*oi->typep));\n+\tif (oi->typep == &real_type)\n+\t\toi->typep = NULL;\n \n \treturn 0;\n }\n-- \n2.4.0.rc1.250.gfbd73bd\n"},{"id":"260462","messageId":"1430663402-26717-2-git-send-email-karthik.188@gmail.com","threadId":"39225","inReplyTo":"1430663402-26717-1-git-send-email-karthik.188@gmail.com","subject":"[PATCH v10 2/4] cat-file: make the options mutually exclusive","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-03T14:30:00Z","receivedAt":"2015-05-03T14:30:00Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"We only parse the options if 2 or 3 arguments are specified.\nUpdate 'struct option options[]' to use OPT_CMDMODE rather than\nOPT_SET_INT to allow only one mutually exclusive option and avoid the\nneed for checking number of arguments. This was written by Junio C Hamano,\ntested by me.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n builtin/cat-file.c | 13 +++++--------\n 1 file changed, 5 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex df99df4..53b5376 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -362,12 +362,12 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n \n \tconst struct option options[] = {\n \t\tOPT_GROUP(N_(\"<type> can be one of: blob, tree, commit, tag\")),\n-\t\tOPT_SET_INT('t', NULL, &opt, N_(\"show object type\"), 't'),\n-\t\tOPT_SET_INT('s', NULL, &opt, N_(\"show object size\"), 's'),\n-\t\tOPT_SET_INT('e', NULL, &opt,\n+\t\tOPT_CMDMODE('t', NULL, &opt, N_(\"show object type\"), 't'),\n+\t\tOPT_CMDMODE('s', NULL, &opt, N_(\"show object size\"), 's'),\n+\t\tOPT_CMDMODE('e', NULL, &opt,\n \t\t\t    N_(\"exit with zero when there's no error\"), 'e'),\n-\t\tOPT_SET_INT('p', NULL, &opt, N_(\"pretty-print object's content\"), 'p'),\n-\t\tOPT_SET_INT(0, \"textconv\", &opt,\n+\t\tOPT_CMDMODE('p', NULL, &opt, N_(\"pretty-print object's content\"), 'p'),\n+\t\tOPT_CMDMODE(0, \"textconv\", &opt,\n \t\t\t    N_(\"for blob objects, run textconv on object's content\"), 'c'),\n \t\t{ OPTION_CALLBACK, 0, \"batch\", &batch, \"format\",\n \t\t\tN_(\"show info and content of objects fed from the standard input\"),\n@@ -380,9 +380,6 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n \n \tgit_config(git_cat_file_config, NULL);\n \n-\tif (argc != 3 && argc != 2)\n-\t\tusage_with_options(cat_file_usage, options);\n-\n \targc = parse_options(argc, argv, prefix, options, cat_file_usage, 0);\n \n \tif (opt) {\n-- \n2.4.0.rc1.250.gfbd73bd\n"},{"id":"260463","messageId":"1430663402-26717-3-git-send-email-karthik.188@gmail.com","threadId":"39225","inReplyTo":"1430663402-26717-1-git-send-email-karthik.188@gmail.com","subject":"[PATCH v10 3/4] cat-file: teach cat-file a '--allow-unknown-type' option","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-03T14:30:01Z","receivedAt":"2015-05-03T14:30:01Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"'git cat-file' throws an error while trying to print the type or\nsize of a broken/corrupt object. This is because these objects are\nusually of unknown types.\n\nTeach git cat-file a '--allow-unknown-type' option where it prints\nthe type or size of a broken/corrupt object without throwing\nan error.\n\nModify '-t' and '-s' options to call sha1_object_info_extended()\ndirectly to support the '--allow-unknown-type' option.\n\nAdd documentation for 'cat-file --allow-unknown-type'.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n\ncat-file: add documentation for '--allow-unknown-type' option.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n Documentation/git-cat-file.txt |  5 ++++-\n builtin/cat-file.c             | 38 ++++++++++++++++++++++++++------------\n 2 files changed, 30 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt\nindex f6a16f4..499ae7b 100644\n--- a/Documentation/git-cat-file.txt\n+++ b/Documentation/git-cat-file.txt\n@@ -9,7 +9,7 @@ git-cat-file - Provide content or type and size information for repository objec\n SYNOPSIS\n --------\n [verse]\n-'git cat-file' (-t | -s | -e | -p | <type> | --textconv ) <object>\n+'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv ) <object>\n 'git cat-file' (--batch | --batch-check) < <list-of-objects>\n \n DESCRIPTION\n@@ -69,6 +69,9 @@ OPTIONS\n \tnot be combined with any other options or arguments.  See the\n \tsection `BATCH OUTPUT` below for details.\n \n+--allow-unknown-type::\n+\tAllow -s or -t to query broken/corrupt objects of unknown type.\n+\n OUTPUT\n ------\n If '-t' is specified, one of the <type>.\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 53b5376..ecb4888 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -9,13 +9,20 @@\n #include \"userdiff.h\"\n #include \"streaming.h\"\n \n-static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n+static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n+\t\t\tint unknown_type)\n {\n \tunsigned char sha1[20];\n \tenum object_type type;\n \tchar *buf;\n \tunsigned long size;\n \tstruct object_context obj_context;\n+\tstruct object_info oi = {NULL};\n+\tstruct strbuf sb = STRBUF_INIT;\n+\tunsigned flags = LOOKUP_REPLACE_OBJECT;\n+\n+\tif (unknown_type)\n+\t\tflags |= LOOKUP_UNKNOWN_OBJECT;\n \n \tif (get_sha1_with_context(obj_name, 0, sha1, &obj_context))\n \t\tdie(\"Not a valid object name %s\", obj_name);\n@@ -23,20 +30,22 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n \tbuf = NULL;\n \tswitch (opt) {\n \tcase 't':\n-\t\ttype = sha1_object_info(sha1, NULL);\n-\t\tif (type > 0) {\n-\t\t\tprintf(\"%s\\n\", typename(type));\n+\t\toi.typename = &sb;\n+\t\tif (sha1_object_info_extended(sha1, &oi, flags) < 0)\n+\t\t\tdie(\"git cat-file: could not get object info\");\n+\t\tif (sb.len) {\n+\t\t\tprintf(\"%s\\n\", sb.buf);\n+\t\t\tstrbuf_release(&sb);\n \t\t\treturn 0;\n \t\t}\n \t\tbreak;\n \n \tcase 's':\n-\t\ttype = sha1_object_info(sha1, &size);\n-\t\tif (type > 0) {\n-\t\t\tprintf(\"%lu\\n\", size);\n-\t\t\treturn 0;\n-\t\t}\n-\t\tbreak;\n+\t\toi.sizep = &size;\n+\t\tif (sha1_object_info_extended(sha1, &oi, flags) < 0)\n+\t\t\tdie(\"git cat-file: could not get object info\");\n+\t\tprintf(\"%lu\\n\", size);\n+\t\treturn 0;\n \n \tcase 'e':\n \t\treturn !has_sha1_file(sha1);\n@@ -323,7 +332,7 @@ static int batch_objects(struct batch_options *opt)\n }\n \n static const char * const cat_file_usage[] = {\n-\tN_(\"git cat-file (-t | -s | -e | -p | <type> | --textconv) <object>\"),\n+\tN_(\"git cat-file (-t [--allow-unknown-type]|-s [--allow-unknown-type]|-e|-p|<type>|--textconv) <object>\"),\n \tN_(\"git cat-file (--batch | --batch-check) < <list-of-objects>\"),\n \tNULL\n };\n@@ -359,6 +368,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n \tint opt = 0;\n \tconst char *exp_type = NULL, *obj_name = NULL;\n \tstruct batch_options batch = {0};\n+\tint unknown_type = 0;\n \n \tconst struct option options[] = {\n \t\tOPT_GROUP(N_(\"<type> can be one of: blob, tree, commit, tag\")),\n@@ -369,6 +379,8 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n \t\tOPT_CMDMODE('p', NULL, &opt, N_(\"pretty-print object's content\"), 'p'),\n \t\tOPT_CMDMODE(0, \"textconv\", &opt,\n \t\t\t    N_(\"for blob objects, run textconv on object's content\"), 'c'),\n+\t\tOPT_BOOL( 0, \"allow-unknown-type\", &unknown_type,\n+\t\t\t  N_(\"allow -s and -t to work with broken/corrupt objects\")),\n \t\t{ OPTION_CALLBACK, 0, \"batch\", &batch, \"format\",\n \t\t\tN_(\"show info and content of objects fed from the standard input\"),\n \t\t\tPARSE_OPT_OPTARG, batch_option_callback },\n@@ -402,5 +414,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n \tif (batch.enabled)\n \t\treturn batch_objects(&batch);\n \n-\treturn cat_one_file(opt, exp_type, obj_name);\n+\tif (unknown_type && opt != 't' && opt != 's')\n+\t\tdie(\"git cat-file --allow-unknown-type: use with -s or -t\");\n+\treturn cat_one_file(opt, exp_type, obj_name, unknown_type);\n }\n-- \n2.4.0.rc1.250.gfbd73bd\n"},{"id":"260464","messageId":"1430663402-26717-4-git-send-email-karthik.188@gmail.com","threadId":"39225","inReplyTo":"1430663402-26717-1-git-send-email-karthik.188@gmail.com","subject":"[PATCH v10 4/4] t1006: add tests for git cat-file --allow-unknown-type","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-03T14:30:02Z","receivedAt":"2015-05-03T14:30:02Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n t/t1006-cat-file.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 45 insertions(+)\n\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex ab36b1e..de8eaf1 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -47,6 +47,18 @@ $content\"\n \ttest_cmp expect actual\n     '\n \n+    test_expect_success \"Type of $type is correct using --allow-unknown-type\" '\n+\techo $type >expect &&\n+    git cat-file -t --allow-unknown-type $sha1 >actual &&\n+\ttest_cmp expect actual\n+    '\n+\n+    test_expect_success \"Size of $type is correct using --allow-unknown-type\" '\n+\techo $size >expect &&\n+    git cat-file -s --allow-unknown-type $sha1 >actual &&\n+\ttest_cmp expect actual\n+    '\n+\n     test -z \"$content\" ||\n     test_expect_success \"Content of $type is correct\" '\n \tmaybe_remove_timestamp \"$content\" $no_ts >expect &&\n@@ -296,4 +308,37 @@ test_expect_success '%(deltabase) reports packed delta bases' '\n \t}\n '\n \n+bogus_type=\"bogus\"\n+bogus_content=\"bogus\"\n+bogus_size=$(strlen \"$bogus_content\")\n+bogus_sha1=$(echo_without_newline \"$bogus_content\" | git hash-object -t $bogus_type --literally -w --stdin)\n+\n+test_expect_success \"Type of broken object is correct\" '\n+\techo $bogus_type >expect &&\n+\tgit cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success \"Size of broken object is correct\" '\n+\techo $bogus_size >expect &&\n+\tgit cat-file -s --allow-unknown-type $bogus_sha1 >actual &&\n+\ttest_cmp expect actual\n+'\n+bogus_type=\"abcdefghijklmnopqrstuvwxyz1234679\"\n+bogus_content=\"bogus\"\n+bogus_size=$(strlen \"$bogus_content\")\n+bogus_sha1=$(echo_without_newline \"$bogus_content\" | git hash-object -t $bogus_type --literally -w --stdin)\n+\n+test_expect_success \"Type of broken object is correct when type is large\" '\n+\techo $bogus_type >expect &&\n+\tgit cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success \"Size of large broken object is correct when type is large\" '\n+\techo $bogus_size >expect &&\n+\tgit cat-file -s --allow-unknown-type $bogus_sha1 >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \n2.4.0.rc1.250.gfbd73bd\n"},{"id":"260499","messageId":"xmqqzj5ltd6c.fsf@gitster.dls.corp.google.com","threadId":"39225","inReplyTo":"55463094.9040204@gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-04T00:10:51Z","receivedAt":"2015-05-04T00:10:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hmmmm... you do not seem to pass your own test.\n\nexpecting success: \n        echo $bogus_type >expect &&\n        git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n        test_cmp expect actual\n\n--- expect      2015-05-04 00:09:24.327335512 +0000\n+++ actual      2015-05-04 00:09:24.335335473 +0000\n@@ -1 +1 @@\n-abcdefghijklmnopqrstuvwxyz1234679\n+abcdefghijklmnopqrstuvwxyz123467abcdefghijklmnopqrstuvwxyz1234679\nnot ok 86 - Type of broken object is correct when type is large\n"},{"id":"260500","messageId":"xmqqvbg9td0x.fsf@gitster.dls.corp.google.com","threadId":"39225","inReplyTo":"xmqqzj5ltd6c.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-04T00:14:06Z","receivedAt":"2015-05-04T00:14:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Hmmmm... you do not seem to pass your own test.\n>\n> expecting success: \n>         echo $bogus_type >expect &&\n>         git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>         test_cmp expect actual\n>\n> --- expect      2015-05-04 00:09:24.327335512 +0000\n> +++ actual      2015-05-04 00:09:24.335335473 +0000\n> @@ -1 +1 @@\n> -abcdefghijklmnopqrstuvwxyz1234679\n> +abcdefghijklmnopqrstuvwxyz123467abcdefghijklmnopqrstuvwxyz1234679\n> not ok 86 - Type of broken object is correct when type is large\n\nPerhaps it would have a better chance of being correct with this\nsquashed in.\n\n-- >8 --\n[PATCH] fixup! sha1_file: support reading from a loose object of unknown type\n\n---\n sha1_file.c | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex f65bf90..e010e7c 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1568,7 +1568,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n \t\t\t\t\tunsigned long mapsize, void *buffer,\n \t\t\t\t\tunsigned long bufsiz, struct strbuf *header)\n {\n-\tunsigned char *cp;\n \tint status;\n \n \tstatus = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n@@ -1579,7 +1578,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n \tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n \t\treturn 0;\n \n-\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n \tdo {\n \t\tstatus = git_inflate(stream, 0);\n \t\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n-- \n2.4.0-282-g4432dd4\n"},{"id":"260501","messageId":"CAPig+cQKqkoqN+o_QfVBRvxGdNuJn_oxD5YMsvnBOHguimJhGQ@mail.gmail.com","threadId":"39225","inReplyTo":"xmqqvbg9td0x.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-04T02:55:40Z","receivedAt":"2015-05-04T02:55:40Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 3, 2015 at 8:14 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Hmmmm... you do not seem to pass your own test.\n>>\n>> expecting success:\n>>         echo $bogus_type >expect &&\n>>         git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>>         test_cmp expect actual\n>>\n>> --- expect      2015-05-04 00:09:24.327335512 +0000\n>> +++ actual      2015-05-04 00:09:24.335335473 +0000\n>> @@ -1 +1 @@\n>> -abcdefghijklmnopqrstuvwxyz1234679\n>> +abcdefghijklmnopqrstuvwxyz123467abcdefghijklmnopqrstuvwxyz1234679\n>> not ok 86 - Type of broken object is correct when type is large\n>\n> Perhaps it would have a better chance of being correct with this\n> squashed in.\n\nInterestingly, neither test passes on Mac OS X even with this fixup.\nIn fact, the git-hash-object invocation which computes/retrieves\n'bogus_sha1' with the extra long bogus type crashes with SIGABRT in\nwrite_sha1_file_prepare(). Still investigating.\n\n> -- >8 --\n> [PATCH] fixup! sha1_file: support reading from a loose object of unknown type\n>\n> ---\n>  sha1_file.c | 2 --\n>  1 file changed, 2 deletions(-)\n>\n> diff --git a/sha1_file.c b/sha1_file.c\n> index f65bf90..e010e7c 100644\n> --- a/sha1_file.c\n> +++ b/sha1_file.c\n> @@ -1568,7 +1568,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n>                                         unsigned long mapsize, void *buffer,\n>                                         unsigned long bufsiz, struct strbuf *header)\n>  {\n> -       unsigned char *cp;\n>         int status;\n>\n>         status = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n> @@ -1579,7 +1578,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n>         if (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n>                 return 0;\n>\n> -       strbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n>         do {\n>                 status = git_inflate(stream, 0);\n>                 strbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n> --\n> 2.4.0-282-g4432dd4\n"},{"id":"260502","messageId":"CAPig+cStUNPZqEyE1rJVj5AsTeZFU54mc97rgQqiPbr5V1B0Sw@mail.gmail.com","threadId":"39225","inReplyTo":"CAPig+cQKqkoqN+o_QfVBRvxGdNuJn_oxD5YMsvnBOHguimJhGQ@mail.gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-04T03:30:39Z","receivedAt":"2015-05-04T03:30:39Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 3, 2015 at 10:55 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Sun, May 3, 2015 at 8:14 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Hmmmm... you do not seem to pass your own test.\n>>>\n>>> expecting success:\n>>>         echo $bogus_type >expect &&\n>>>         git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>>>         test_cmp expect actual\n>>>\n>>> --- expect      2015-05-04 00:09:24.327335512 +0000\n>>> +++ actual      2015-05-04 00:09:24.335335473 +0000\n>>> @@ -1 +1 @@\n>>> -abcdefghijklmnopqrstuvwxyz1234679\n>>> +abcdefghijklmnopqrstuvwxyz123467abcdefghijklmnopqrstuvwxyz1234679\n>>> not ok 86 - Type of broken object is correct when type is large\n>>\n>> Perhaps it would have a better chance of being correct with this\n>> squashed in.\n>\n> Interestingly, neither test passes on Mac OS X even with this fixup.\n> In fact, the git-hash-object invocation which computes/retrieves\n> 'bogus_sha1' with the extra long bogus type crashes with SIGABRT in\n> write_sha1_file_prepare(). Still investigating.\n\nIt's a buffer overflow problem. I'm preparing a patch.\n"},{"id":"260523","messageId":"55477478.9010406@gmail.com","threadId":"39225","inReplyTo":"xmqqvbg9td0x.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"karthik nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-04T13:30:32Z","receivedAt":"2015-05-04T13:30:32Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\n\nOn 05/04/2015 05:44 AM, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Hmmmm... you do not seem to pass your own test.\n>>\n>> expecting success:\n>>          echo $bogus_type >expect &&\n>>          git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>>          test_cmp expect actual\n>>\n>> --- expect      2015-05-04 00:09:24.327335512 +0000\n>> +++ actual      2015-05-04 00:09:24.335335473 +0000\n>> @@ -1 +1 @@\n>> -abcdefghijklmnopqrstuvwxyz1234679\n>> +abcdefghijklmnopqrstuvwxyz123467abcdefghijklmnopqrstuvwxyz1234679\n>> not ok 86 - Type of broken object is correct when type is large\n>\n> Perhaps it would have a better chance of being correct with this\n> squashed in.\n>\n> -- >8 --\n> [PATCH] fixup! sha1_file: support reading from a loose object of unknown type\n>\n> ---\n>   sha1_file.c | 2 --\n>   1 file changed, 2 deletions(-)\n>\n> diff --git a/sha1_file.c b/sha1_file.c\n> index f65bf90..e010e7c 100644\n> --- a/sha1_file.c\n> +++ b/sha1_file.c\n> @@ -1568,7 +1568,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n>   \t\t\t\t\tunsigned long mapsize, void *buffer,\n>   \t\t\t\t\tunsigned long bufsiz, struct strbuf *header)\n>   {\n> -\tunsigned char *cp;\n>   \tint status;\n>\n>   \tstatus = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n> @@ -1579,7 +1578,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n>   \tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n>   \t\treturn 0;\n>\n> -\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\nOk this works, weird, I test before sending patches, anyways getting to \nthe point of discussion, shouldn't we have add the buf, since we did \ninflate once, before doing inflate again?\n>   \tdo {\n>   \t\tstatus = git_inflate(stream, 0);\n>   \t\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n>\n"},{"id":"260524","messageId":"554774A4.4020504@gmail.com","threadId":"39225","inReplyTo":"CAPig+cStUNPZqEyE1rJVj5AsTeZFU54mc97rgQqiPbr5V1B0Sw@mail.gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"karthik nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-04T13:31:16Z","receivedAt":"2015-05-04T13:31:16Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\n\nOn 05/04/2015 09:00 AM, Eric Sunshine wrote:\n> On Sun, May 3, 2015 at 10:55 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>> On Sun, May 3, 2015 at 8:14 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Junio C Hamano <gitster@pobox.com> writes:\n>>>\n>>>> Hmmmm... you do not seem to pass your own test.\n>>>>\n>>>> expecting success:\n>>>>          echo $bogus_type >expect &&\n>>>>          git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>>>>          test_cmp expect actual\n>>>>\n>>>> --- expect      2015-05-04 00:09:24.327335512 +0000\n>>>> +++ actual      2015-05-04 00:09:24.335335473 +0000\n>>>> @@ -1 +1 @@\n>>>> -abcdefghijklmnopqrstuvwxyz1234679\n>>>> +abcdefghijklmnopqrstuvwxyz123467abcdefghijklmnopqrstuvwxyz1234679\n>>>> not ok 86 - Type of broken object is correct when type is large\n>>>\n>>> Perhaps it would have a better chance of being correct with this\n>>> squashed in.\n>>\n>> Interestingly, neither test passes on Mac OS X even with this fixup.\n>> In fact, the git-hash-object invocation which computes/retrieves\n>> 'bogus_sha1' with the extra long bogus type crashes with SIGABRT in\n>> write_sha1_file_prepare(). Still investigating.\n>\n> It's a buffer overflow problem. I'm preparing a patch.\n>\nJust saw your patch, thanks Eric.\n"},{"id":"260550","messageId":"xmqqioc8rrg0.fsf@gitster.dls.corp.google.com","threadId":"39225","inReplyTo":"55477478.9010406@gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-04T20:57:51Z","receivedAt":"2015-05-04T20:57:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"karthik nayak <karthik.188@gmail.com> writes:\n\n>> @@ -1579,7 +1578,6 @@ static int unpack_sha1_heade\n>>   \tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n>>   \t\treturn 0;\n>>\n>> -\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n> Ok this works, weird, I test before sending patches, anyways getting\n> to the point of discussion, shouldn't we have add the buf, since we\n> did inflate once, before doing inflate again?\n\n+static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n+\t\t\t\t\tunsigned long mapsize, void *buffer,\n+\t\t\t\t\tunsigned long bufsiz, struct strbuf *header)\n+{\n+\tunsigned char *cp;\n+\tint status;\n+\n+\tstatus = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n\nHere, buffer..stream->next_out contains the inflated result\n\n+\t/*\n+\t * Check if entire header is unpacked in the first iteration.\n+\t */\n+\tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n+\t\treturn 0;\n+\n+\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n\n... and that is copied to header.buf ...\n\n+\tdo {\n+\t\tstatus = git_inflate(stream, 0);\n\n... and then we inflate further into where?\n\nIt inflates to stream->next_out and then advances the pointer\n\n+\t\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n\n... and then the same buffer..stream->next_out (whose early part\nalready holds the result from the initial inflation) is appended\nto header.\n\n+\t\tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n+\t\t\treturn 0;\n+\t\tstream->next_out = buffer;\n+\t\tstream->avail_out = bufsiz;\n\nI think my squash is wrong.  The initial inflate must have filled\nbuffer[0..bufsiz] without any NULs, leaving stream->next_out at the\nend of the buffer, and subsequent git_inflate() it will clobber\nbeyond the tail of the buffer.\n\nIt should have been more like this, I think.\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex f65bf90..37e6f2c 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1568,7 +1568,6 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n \t\t\t\t\tunsigned long mapsize, void *buffer,\n \t\t\t\t\tunsigned long bufsiz, struct strbuf *header)\n {\n-\tunsigned char *cp;\n \tint status;\n \n \tstatus = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n@@ -1579,7 +1578,15 @@ static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n \tif (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n \t\treturn 0;\n \n+\t/*\n+\t * buffer[0..bufsiz] was not large enough.  Copy the partial\n+\t * result out to header, and then append the result of further\n+\t * reading the stream.\n+\t */\n \tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n+\tstream->next_out = buffer;\n+\tstream->avail_out = bufsiz;\n+\n \tdo {\n \t\tstatus = git_inflate(stream, 0);\n \t\tstrbuf_add(header, buffer, stream->next_out - (unsigned char *)buffer);\n"},{"id":"260570","messageId":"CAPig+cTitnC7zvWJEwdo2cMWNE+3ODjd++81bYdg-qTc0bzgog@mail.gmail.com","threadId":"39225","inReplyTo":"1430663402-26717-1-git-send-email-karthik.188@gmail.com","subject":"Re: [PATCH v10 1/4] sha1_file: support reading from a loose object of unknown type","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-04T23:34:02Z","receivedAt":"2015-05-04T23:34:02Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 3, 2015 at 10:29 AM, Karthik Nayak <karthik.188@gmail.com> wrote:\n> Update sha1_loose_object_info() to optionally allow it to read\n> from a loose object file of unknown/bogus type; as the function\n> usually returns the type of the object it read in the form of enum\n> for known types, add an optional \"typename\" field to receive the\n> name of the type in textual form and a flag to indicate the reading\n> of a loose object file of unknown/bogus type.\n>\n> Add parse_sha1_header_extended() which acts as a wrapper around\n> parse_sha1_header() allowing more information to be obtained.\n>\n> Add unpack_sha1_header_to_strbuf() to unpack sha1 headers of\n> unknown/corrupt objects which have a unknown sha1 header size to\n> a strbuf structure. This was written by Junio C Hamano but tested\n> by me.\n> ---\n> diff --git a/cache.h b/cache.h\n> index 3d3244b..38419c3 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -1564,6 +1564,33 @@ int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long ma\n> +static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n> +                                       unsigned long mapsize, void *buffer,\n> +                                       unsigned long bufsiz, struct strbuf *header)\n> +{\n> +       unsigned char *cp;\n> +       int status;\n> +\n> +       status = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n> +\n> +       /*\n> +        * Check if entire header is unpacked in the first iteration.\n> +        */\n\nNit: You could save some precious vertical screen real-estate by using\none-line /* comment style */.\n\n> +       if (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n> +               return 0;\n> +\n> @@ -1614,27 +1641,38 @@ static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long s\n>   * too permissive for what we want to check. So do an anal\n>   * object header parse by hand.\n>   */\n> -int parse_sha1_header(const char *hdr, unsigned long *sizep)\n> +static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,\n> +                              unsigned int flags)\n>  {\n> [...]\n> +\n> +       type = type_from_string_gently(type_buf, type_len, 1);\n> +       if (oi->typename)\n> +               strbuf_add(oi->typename, type_buf, type_len);\n> +       /*\n> +        * Set type to 0 if its an unknown object and\n> +        * we're obtaining the type using '--allow-unkown-type'\n> +        * option.\n> +        */\n> +       if ((flags & LOOKUP_UNKNOWN_OBJECT) && (type < 0))\n> +               type = 0;\n\nThe comment says exactly what the code already says, thus it adds no\nvalue. A better comment would explain _why_ type is set to 0 under\nthese conditions.\n\n> +       else if (type < 0)\n> +               die(\"invalid object type\");\n> +       if (oi->typep)\n> +               *oi->typep = type;\n>\n>         /*\n>          * The length must follow immediately, and be in canonical\n> @@ -1652,12 +1690,24 @@ int parse_sha1_header(const char *hdr, unsigned long *sizep)\n>                         size = size * 10 + c;\n>                 }\n>         }\n> -       *sizep = size;\n> +\n> +       if (oi->sizep)\n> +               *oi->sizep = size;\n>\n>         /*\n>          * The length must be followed by a zero byte\n>          */\n\nNit: Save precious vertical screen real-estate with one-line /*\ncomment style */.\n\n> -       return *hdr ? -1 : type_from_string(type);\n> +       return *hdr ? -1 : type;\n> +}\n> +\n"},{"id":"260575","messageId":"CAPig+cSw_AAQ+sdUu2-64z+u9SEDS_sU2ObATP4puM5GD1VOyA@mail.gmail.com","threadId":"39225","inReplyTo":"1430663402-26717-3-git-send-email-karthik.188@gmail.com","subject":"Re: [PATCH v10 3/4] cat-file: teach cat-file a '--allow-unknown-type' option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-05T01:29:16Z","receivedAt":"2015-05-05T01:29:16Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 3, 2015 at 10:30 AM, Karthik Nayak <karthik.188@gmail.com> wrote:\n> 'git cat-file' throws an error while trying to print the type or\n> size of a broken/corrupt object. This is because these objects are\n> usually of unknown types.\n>\n> Teach git cat-file a '--allow-unknown-type' option where it prints\n> the type or size of a broken/corrupt object without throwing\n> an error.\n>\n> Modify '-t' and '-s' options to call sha1_object_info_extended()\n> directly to support the '--allow-unknown-type' option.\n>\n> Add documentation for 'cat-file --allow-unknown-type'.\n\nThis round is looking much better than earlier rounds. Just a few very\nminor comments below...\n\n> Helped-by: Junio C Hamano <gitster@pobox.com>\n> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>\n> cat-file: add documentation for '--allow-unknown-type' option.\n>\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n\nThis got botched when you folded the documentation patch into this\none. Drop the redundant \"cat-file: add documentation...\" line and your\nextra sign-off.\n\n> ---\n> diff --git a/builtin/cat-file.c b/builtin/cat-file.c\n> index 53b5376..ecb4888 100644\n> --- a/builtin/cat-file.c\n> +++ b/builtin/cat-file.c\n> @@ -9,13 +9,20 @@\n>  #include \"userdiff.h\"\n>  #include \"streaming.h\"\n>\n> -static int cat_one_file(int opt, const char *exp_type, const char *obj_name)\n> +static int cat_one_file(int opt, const char *exp_type, const char *obj_name,\n> +                       int unknown_type)\n>  {\n>         unsigned char sha1[20];\n>         enum object_type type;\n>         char *buf;\n>         unsigned long size;\n>         struct object_context obj_context;\n> +       struct object_info oi = {NULL};\n> +       struct strbuf sb = STRBUF_INIT;\n> +       unsigned flags = LOOKUP_REPLACE_OBJECT;\n> +\n> +       if (unknown_type)\n> +               flags |= LOOKUP_UNKNOWN_OBJECT;\n\nNit: 'allow_unknown' (or perhaps 'allow_unknown_type') would be a more\ninformative variable name than 'unknown_type', and would make this\nconditional easier to understand.\n\n>         if (get_sha1_with_context(obj_name, 0, sha1, &obj_context))\n>                 die(\"Not a valid object name %s\", obj_name);\n> @@ -359,6 +368,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n>         int opt = 0;\n>         const char *exp_type = NULL, *obj_name = NULL;\n>         struct batch_options batch = {0};\n> +       int unknown_type = 0;\n\nDitto: s/unknown_type/allow_unknown/\n\n>         const struct option options[] = {\n>                 OPT_GROUP(N_(\"<type> can be one of: blob, tree, commit, tag\")),\n> @@ -369,6 +379,8 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n>                 OPT_CMDMODE('p', NULL, &opt, N_(\"pretty-print object's content\"), 'p'),\n>                 OPT_CMDMODE(0, \"textconv\", &opt,\n>                             N_(\"for blob objects, run textconv on object's content\"), 'c'),\n> +               OPT_BOOL( 0, \"allow-unknown-type\", &unknown_type,\n> +                         N_(\"allow -s and -t to work with broken/corrupt objects\")),\n>                 { OPTION_CALLBACK, 0, \"batch\", &batch, \"format\",\n>                         N_(\"show info and content of objects fed from the standard input\"),\n>                         PARSE_OPT_OPTARG, batch_option_callback },\n> @@ -402,5 +414,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)\n>         if (batch.enabled)\n>                 return batch_objects(&batch);\n>\n> -       return cat_one_file(opt, exp_type, obj_name);\n> +       if (unknown_type && opt != 't' && opt != 's')\n> +               die(\"git cat-file --allow-unknown-type: use with -s or -t\");\n> +       return cat_one_file(opt, exp_type, obj_name, unknown_type);\n>  }\n> --\n> 2.4.0.rc1.250.gfbd73bd\n"},{"id":"260576","messageId":"CAPig+cTOVFem74yr4HPqDRU3-4s_B58jQsx14ntp5FsB0WR6SA@mail.gmail.com","threadId":"39225","inReplyTo":"1430663402-26717-4-git-send-email-karthik.188@gmail.com","subject":"Re: [PATCH v10 4/4] t1006: add tests for git cat-file --allow-unknown-type","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-05-05T01:33:16Z","receivedAt":"2015-05-05T01:33:16Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 3, 2015 at 10:30 AM, Karthik Nayak <karthik.188@gmail.com> wrote:\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>  t/t1006-cat-file.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 45 insertions(+)\n>\n> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\n> index ab36b1e..de8eaf1 100755\n> --- a/t/t1006-cat-file.sh\n> +++ b/t/t1006-cat-file.sh\n> @@ -47,6 +47,18 @@ $content\"\n>         test_cmp expect actual\n>      '\n>\n> +    test_expect_success \"Type of $type is correct using --allow-unknown-type\" '\n> +       echo $type >expect &&\n> +    git cat-file -t --allow-unknown-type $sha1 >actual &&\n\nIndentation is still botched in this test and the next one (as\nmentioned previously [1]).\n\n[1]: http://article.gmane.org/gmane.comp.version-control.git/268005\n\n> +       test_cmp expect actual\n> +    '\n> +\n> +    test_expect_success \"Size of $type is correct using --allow-unknown-type\" '\n> +       echo $size >expect &&\n> +    git cat-file -s --allow-unknown-type $sha1 >actual &&\n> +       test_cmp expect actual\n> +    '\n> +\n>      test -z \"$content\" ||\n>      test_expect_success \"Content of $type is correct\" '\n>         maybe_remove_timestamp \"$content\" $no_ts >expect &&\n> @@ -296,4 +308,37 @@ test_expect_success '%(deltabase) reports packed delta bases' '\n>         }\n>  '\n>\n> +bogus_type=\"bogus\"\n> +bogus_content=\"bogus\"\n> +bogus_size=$(strlen \"$bogus_content\")\n> +bogus_sha1=$(echo_without_newline \"$bogus_content\" | git hash-object -t $bogus_type --literally -w --stdin)\n> +\n> +test_expect_success \"Type of broken object is correct\" '\n> +       echo $bogus_type >expect &&\n> +       git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n> +       test_cmp expect actual\n> +'\n> +\n> +test_expect_success \"Size of broken object is correct\" '\n> +       echo $bogus_size >expect &&\n> +       git cat-file -s --allow-unknown-type $bogus_sha1 >actual &&\n> +       test_cmp expect actual\n> +'\n> +bogus_type=\"abcdefghijklmnopqrstuvwxyz1234679\"\n> +bogus_content=\"bogus\"\n> +bogus_size=$(strlen \"$bogus_content\")\n> +bogus_sha1=$(echo_without_newline \"$bogus_content\" | git hash-object -t $bogus_type --literally -w --stdin)\n> +\n> +test_expect_success \"Type of broken object is correct when type is large\" '\n> +       echo $bogus_type >expect &&\n> +       git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n> +       test_cmp expect actual\n> +'\n> +\n> +test_expect_success \"Size of large broken object is correct when type is large\" '\n> +       echo $bogus_size >expect &&\n> +       git cat-file -s --allow-unknown-type $bogus_sha1 >actual &&\n> +       test_cmp expect actual\n> +'\n> +\n>  test_done\n> --\n> 2.4.0.rc1.250.gfbd73bd\n"},{"id":"260577","messageId":"55482936.7020205@gmail.com","threadId":"39225","inReplyTo":"CAPig+cTitnC7zvWJEwdo2cMWNE+3ODjd++81bYdg-qTc0bzgog@mail.gmail.com","subject":"Re: [PATCH v10 1/4] sha1_file: support reading from a loose object of unknown type","fromName":"karthik nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-05T02:21:42Z","receivedAt":"2015-05-05T02:21:42Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\n\nOn 05/05/2015 05:04 AM, Eric Sunshine wrote:\n> On Sun, May 3, 2015 at 10:29 AM, Karthik Nayak <karthik.188@gmail.com> wrote:\n>> Update sha1_loose_object_info() to optionally allow it to read\n>> from a loose object file of unknown/bogus type; as the function\n>> usually returns the type of the object it read in the form of enum\n>> for known types, add an optional \"typename\" field to receive the\n>> name of the type in textual form and a flag to indicate the reading\n>> of a loose object file of unknown/bogus type.\n>>\n>> Add parse_sha1_header_extended() which acts as a wrapper around\n>> parse_sha1_header() allowing more information to be obtained.\n>>\n>> Add unpack_sha1_header_to_strbuf() to unpack sha1 headers of\n>> unknown/corrupt objects which have a unknown sha1 header size to\n>> a strbuf structure. This was written by Junio C Hamano but tested\n>> by me.\n>> ---\n>> diff --git a/cache.h b/cache.h\n>> index 3d3244b..38419c3 100644\n>> --- a/cache.h\n>> +++ b/cache.h\n>> @@ -1564,6 +1564,33 @@ int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long ma\n>> +static int unpack_sha1_header_to_strbuf(git_zstream *stream, unsigned char *map,\n>> +                                       unsigned long mapsize, void *buffer,\n>> +                                       unsigned long bufsiz, struct strbuf *header)\n>> +{\n>> +       unsigned char *cp;\n>> +       int status;\n>> +\n>> +       status = unpack_sha1_header(stream, map, mapsize, buffer, bufsiz);\n>> +\n>> +       /*\n>> +        * Check if entire header is unpacked in the first iteration.\n>> +        */\n>\n> Nit: You could save some precious vertical screen real-estate by using\n> one-line /* comment style */.\n>\n>> +       if (memchr(buffer, '\\0', stream->next_out - (unsigned char *)buffer))\n>> +               return 0;\n>> +\n>> @@ -1614,27 +1641,38 @@ static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long s\n>>    * too permissive for what we want to check. So do an anal\n>>    * object header parse by hand.\n>>    */\n>> -int parse_sha1_header(const char *hdr, unsigned long *sizep)\n>> +static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,\n>> +                              unsigned int flags)\n>>   {\n>> [...]\n>> +\n>> +       type = type_from_string_gently(type_buf, type_len, 1);\n>> +       if (oi->typename)\n>> +               strbuf_add(oi->typename, type_buf, type_len);\n>> +       /*\n>> +        * Set type to 0 if its an unknown object and\n>> +        * we're obtaining the type using '--allow-unkown-type'\n>> +        * option.\n>> +        */\n>> +       if ((flags & LOOKUP_UNKNOWN_OBJECT) && (type < 0))\n>> +               type = 0;\n>\n> The comment says exactly what the code already says, thus it adds no\n> value. A better comment would explain _why_ type is set to 0 under\n> these conditions.\n>\n>> +       else if (type < 0)\n>> +               die(\"invalid object type\");\n>> +       if (oi->typep)\n>> +               *oi->typep = type;\n>>\n>>          /*\n>>           * The length must follow immediately, and be in canonical\n>> @@ -1652,12 +1690,24 @@ int parse_sha1_header(const char *hdr, unsigned long *sizep)\n>>                          size = size * 10 + c;\n>>                  }\n>>          }\n>> -       *sizep = size;\n>> +\n>> +       if (oi->sizep)\n>> +               *oi->sizep = size;\n>>\n>>          /*\n>>           * The length must be followed by a zero byte\n>>           */\n>\n> Nit: Save precious vertical screen real-estate with one-line /*\n> comment style */.\n>\n>> -       return *hdr ? -1 : type_from_string(type);\n>> +       return *hdr ? -1 : type;\n>> +}\n>> +\n\nThanks for your suggestions Eric.\n"},{"id":"260578","messageId":"55482984.1000600@gmail.com","threadId":"39225","inReplyTo":"CAPig+cTOVFem74yr4HPqDRU3-4s_B58jQsx14ntp5FsB0WR6SA@mail.gmail.com","subject":"Re: [PATCH v10 4/4] t1006: add tests for git cat-file --allow-unknown-type","fromName":"karthik nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-05T02:23:00Z","receivedAt":"2015-05-05T02:23:00Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\n\nOn 05/05/2015 07:03 AM, Eric Sunshine wrote:\n> On Sun, May 3, 2015 at 10:30 AM, Karthik Nayak <karthik.188@gmail.com> wrote:\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>   t/t1006-cat-file.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 45 insertions(+)\n>>\n>> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\n>> index ab36b1e..de8eaf1 100755\n>> --- a/t/t1006-cat-file.sh\n>> +++ b/t/t1006-cat-file.sh\n>> @@ -47,6 +47,18 @@ $content\"\n>>          test_cmp expect actual\n>>       '\n>>\n>> +    test_expect_success \"Type of $type is correct using --allow-unknown-type\" '\n>> +       echo $type >expect &&\n>> +    git cat-file -t --allow-unknown-type $sha1 >actual &&\n>\n> Indentation is still botched in this test and the next one (as\n> mentioned previously [1]).\n>\n> [1]: http://article.gmane.org/gmane.comp.version-control.git/268005\nIt only seems to have affected the test file, I made sure the \nindentation was correct after your previous suggestion, I have to see \nwhy this is happening. Thanks\n>\n>> +       test_cmp expect actual\n>> +    '\n>> +\n>> +    test_expect_success \"Size of $type is correct using --allow-unknown-type\" '\n>> +       echo $size >expect &&\n>> +    git cat-file -s --allow-unknown-type $sha1 >actual &&\n>> +       test_cmp expect actual\n>> +    '\n>> +\n>>       test -z \"$content\" ||\n>>       test_expect_success \"Content of $type is correct\" '\n>>          maybe_remove_timestamp \"$content\" $no_ts >expect &&\n>> @@ -296,4 +308,37 @@ test_expect_success '%(deltabase) reports packed delta bases' '\n>>          }\n>>   '\n>>\n>> +bogus_type=\"bogus\"\n>> +bogus_content=\"bogus\"\n>> +bogus_size=$(strlen \"$bogus_content\")\n>> +bogus_sha1=$(echo_without_newline \"$bogus_content\" | git hash-object -t $bogus_type --literally -w --stdin)\n>> +\n>> +test_expect_success \"Type of broken object is correct\" '\n>> +       echo $bogus_type >expect &&\n>> +       git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>> +       test_cmp expect actual\n>> +'\n>> +\n>> +test_expect_success \"Size of broken object is correct\" '\n>> +       echo $bogus_size >expect &&\n>> +       git cat-file -s --allow-unknown-type $bogus_sha1 >actual &&\n>> +       test_cmp expect actual\n>> +'\n>> +bogus_type=\"abcdefghijklmnopqrstuvwxyz1234679\"\n>> +bogus_content=\"bogus\"\n>> +bogus_size=$(strlen \"$bogus_content\")\n>> +bogus_sha1=$(echo_without_newline \"$bogus_content\" | git hash-object -t $bogus_type --literally -w --stdin)\n>> +\n>> +test_expect_success \"Type of broken object is correct when type is large\" '\n>> +       echo $bogus_type >expect &&\n>> +       git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&\n>> +       test_cmp expect actual\n>> +'\n>> +\n>> +test_expect_success \"Size of large broken object is correct when type is large\" '\n>> +       echo $bogus_size >expect &&\n>> +       git cat-file -s --allow-unknown-type $bogus_sha1 >actual &&\n>> +       test_cmp expect actual\n>> +'\n>> +\n>>   test_done\n>> --\n>> 2.4.0.rc1.250.gfbd73bd\n"},{"id":"260642","messageId":"xmqqa8xicoed.fsf@gitster.dls.corp.google.com","threadId":"39225","inReplyTo":"55482984.1000600@gmail.com","subject":"Re: [PATCH v10 4/4] t1006: add tests for git cat-file --allow-unknown-type","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-06T04:37:14Z","receivedAt":"2015-05-06T04:37:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"karthik nayak <karthik.188@gmail.com> writes:\n\n>>> +    test_expect_success \"Type of $type is correct using --allow-unknown-type\" '\n>>> +       echo $type >expect &&\n>>> +    git cat-file -t --allow-unknown-type $sha1 >actual &&\n>>\n>> Indentation is still botched in this test and the next one (as\n>> mentioned previously [1]).\n>>\n>> [1]: http://article.gmane.org/gmane.comp.version-control.git/268005\n> It only seems to have affected the test file, I made sure the\n> indentation was correct after your previous suggestion, I have to see\n> why this is happening. Thanks\n\nAny other updates planned for this series?  If it were only the\nindentation in the tests, I could locally amend to skip one\nround-trip if I wanted to hurry, and that is why I am asking, as I\nam planning to start merging topics down to 'next' soonish...\n\nThanks.\n"},{"id":"260663","messageId":"554A192D.7000102@gmail.com","threadId":"39225","inReplyTo":"CAPig+cStUNPZqEyE1rJVj5AsTeZFU54mc97rgQqiPbr5V1B0Sw@mail.gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"karthik nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-06T13:37:49Z","receivedAt":"2015-05-06T13:37:49Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"No other changes for now, apart from the changes suggested by\nyou and Eric. You can merge it into 'next'.\n\nRegards,\n-Karthik\n"},{"id":"260665","messageId":"xmqq1titd3t6.fsf@gitster.dls.corp.google.com","threadId":"39225","inReplyTo":"554A192D.7000102@gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-06T17:16:37Z","receivedAt":"2015-05-06T17:16:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"karthik nayak <karthik.188@gmail.com> writes:\n\n> No other changes for now, apart from the changes suggested by\n> you and Eric. You can merge it into 'next'.\n\nDo you mean by \"the changes suggested\" the SQUASH queued on the\ntopic?  If it is more than that, then I'd prefer you to send an\nupdated series, as I do not want to guess how you'd plan to respond\nto these suggestions.\n\nThanks.\n"},{"id":"260699","messageId":"CD7EEBF2-FE5A-4309-86D8-CBF9F205A159@gmail.com","threadId":"39225","inReplyTo":"xmqq1titd3t6.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-05-07T03:34:30Z","receivedAt":"2015-05-07T03:34:30Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\n\nOn May 6, 2015 10:46:37 PM GMT+05:30, Junio C Hamano <gitster@pobox.com> wrote:\n>karthik nayak <karthik.188@gmail.com> writes:\n>\n>> No other changes for now, apart from the changes suggested by\n>> you and Eric. You can merge it into 'next'.\n>\n>Do you mean by \"the changes suggested\" the SQUASH queued on the\n>topic?  If it is more than that, then I'd prefer you to send an\nBy saying \"the changes suggested\" I meant the SQUASH queued on topic\n>updated series, as I do not want to guess how you'd plan to respond\n>to these suggestions.\n>\n>Thanks.\n"},{"id":"260768","messageId":"xmqqfv78p75i.fsf@gitster.dls.corp.google.com","threadId":"39225","inReplyTo":"CD7EEBF2-FE5A-4309-86D8-CBF9F205A159@gmail.com","subject":"Re: [PATCH v10 0/4] cat-file: add support for \"-allow-unknown-type\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-07T18:35:53Z","receivedAt":"2015-05-07T18:35:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> By saying \"the changes suggested\" I meant the SQUASH queued on topic\n\nOK. I've squashed that in.\n\nLet's wait for a few days to see if other people have more comments\nand then start merging the topic down.\n\nThanks.\n"}]}