{"thread":{"id":"27541","subject":"[PATCH 0/4] index-pack (continued)","startedAt":"2011-06-03T22:32:13Z","lastAt":"2011-06-03T22:32:17Z","messageCount":5,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"169276","messageId":"1307140337-27676-1-git-send-email-gitster@pobox.com","threadId":"27541","inReplyTo":null,"subject":"[PATCH 0/4] index-pack (continued)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-03T22:32:13Z","receivedAt":"2011-06-03T22:32:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is a contination of the earlier index-pack series that has been\nin \"stalled\" state. I do not plan to push this forward for 1.7.6 (the\nendgame of this series is a 2.0 material but it will be a long way to\nget there).\n\nJunio C Hamano (4):\n  index-pack: a miniscule refactor\n  index-pack: start learning to emulate \"verify-pack -v\"\n  index-pack: show histogram when emulating \"verify-pack -v\"\n  verify-pack: use index-pack --verify\n\n builtin/index-pack.c  |   74 +++++++++++++++++++++++++--\n builtin/verify-pack.c |  132 +++++++++---------------------------------------\n cache.h               |    1 -\n sha1_file.c           |   55 --------------------\n t/t5302-pack-index.sh |    5 +-\n 5 files changed, 95 insertions(+), 172 deletions(-)\n\n-- \n1.7.6.rc0.106.g68174\n"},{"id":"169278","messageId":"1307140337-27676-2-git-send-email-gitster@pobox.com","threadId":"27541","inReplyTo":"1307140337-27676-1-git-send-email-gitster@pobox.com","subject":"[PATCH 1/4] index-pack: a miniscule refactor","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-03T22:32:14Z","receivedAt":"2011-06-03T22:32:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Introduce a helper function that takes the type of an object and\ntell if it is a delta, as we seem to use this check in many places.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/index-pack.c |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 513fbbc..0216af7 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -498,12 +498,17 @@ static void sha1_object(const void *data, unsigned long size,\n \t}\n }\n \n+static int is_delta_type(enum object_type type)\n+{\n+\treturn (type == OBJ_REF_DELTA || type == OBJ_OFS_DELTA);\n+}\n+\n static void *get_base_data(struct base_data *c)\n {\n \tif (!c->data) {\n \t\tstruct object_entry *obj = c->obj;\n \n-\t\tif (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA) {\n+\t\tif (is_delta_type(obj->type)) {\n \t\t\tvoid *base = get_base_data(c->base);\n \t\t\tvoid *raw = get_data_from_pack(obj);\n \t\t\tc->data = patch_delta(\n@@ -629,7 +634,7 @@ static void parse_pack_objects(unsigned char *sha1)\n \t\tstruct object_entry *obj = &objects[i];\n \t\tvoid *data = unpack_raw_entry(obj, &delta->base);\n \t\tobj->real_type = obj->type;\n-\t\tif (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA) {\n+\t\tif (is_delta_type(obj->type)) {\n \t\t\tnr_deltas++;\n \t\t\tdelta->obj_no = i;\n \t\t\tdelta++;\n@@ -676,7 +681,7 @@ static void parse_pack_objects(unsigned char *sha1)\n \t\tstruct object_entry *obj = &objects[i];\n \t\tstruct base_data base_obj;\n \n-\t\tif (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA)\n+\t\tif (is_delta_type(obj->type))\n \t\t\tcontinue;\n \t\tbase_obj.obj = obj;\n \t\tbase_obj.data = NULL;\n-- \n1.7.6.rc0.106.g68174\n"},{"id":"169277","messageId":"1307140337-27676-3-git-send-email-gitster@pobox.com","threadId":"27541","inReplyTo":"1307140337-27676-1-git-send-email-gitster@pobox.com","subject":"[PATCH 2/4] index-pack: start learning to emulate \"verify-pack -v\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-03T22:32:15Z","receivedAt":"2011-06-03T22:32:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The \"index-pack\" machinery already has almost enough knowledge to produce\nthe same output as \"verify-pack -v\". Fill small gaps in its bookkeeping,\nand teach it to show what it knows.\n\nAdd a few more command line options that do not have to be advertised to\nthe end users. They will be used internally when verify-pack calls this.\nThe eventual goal is to remove verify-pack implementation and redo it as a\nthin wrapper around the index-pack, so that we can remove the rather\nexpensive packed_object_info_detail() API.\n\nThis still does not do the delta-chain-depth histogram yet but that part\nis easy.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/index-pack.c |   43 ++++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 40 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 0216af7..aa3c9c6 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -20,6 +20,8 @@ struct object_entry\n \tunsigned int hdr_size;\n \tenum object_type type;\n \tenum object_type real_type;\n+\tunsigned delta_depth;\n+\tint base_object_no;\n };\n \n union delta_base {\n@@ -535,6 +537,8 @@ static void resolve_delta(struct object_entry *delta_obj,\n \tvoid *base_data, *delta_data;\n \n \tdelta_obj->real_type = base->obj->real_type;\n+\tdelta_obj->delta_depth = base->obj->delta_depth + 1;\n+\tdelta_obj->base_object_no = base->obj - objects;\n \tdelta_data = get_data_from_pack(delta_obj);\n \tbase_data = get_base_data(base);\n \tresult->obj = delta_obj;\n@@ -967,9 +971,32 @@ static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)\n \tfree(p);\n }\n \n+static void show_pack_info(int stat_only)\n+{\n+\tint i;\n+\tfor (i = 0; i < nr_objects; i++) {\n+\t\tstruct object_entry *obj = &objects[i];\n+\n+\t\t/* NEEDSWORK: Compute data necessary for the \"histogram\" here */\n+\n+\t\tif (stat_only)\n+\t\t\tcontinue;\n+\t\tprintf(\"%s %-6s %lu %lu %\"PRIuMAX,\n+\t\t       sha1_to_hex(obj->idx.sha1),\n+\t\t       typename(obj->real_type), obj->size,\n+\t\t       (unsigned long)(obj[1].idx.offset - obj->idx.offset),\n+\t\t       (uintmax_t)obj->idx.offset);\n+\t\tif (is_delta_type(obj->type)) {\n+\t\t\tstruct object_entry *bobj = &objects[obj->base_object_no];\n+\t\t\tprintf(\" %u %s\", obj->delta_depth, sha1_to_hex(bobj->idx.sha1));\n+\t\t}\n+\t\tputchar('\\n');\n+\t}\n+}\n+\n int cmd_index_pack(int argc, const char **argv, const char *prefix)\n {\n-\tint i, fix_thin_pack = 0, verify = 0;\n+\tint i, fix_thin_pack = 0, verify = 0, stat_only = 0, stat = 0;\n \tconst char *curr_pack, *curr_index;\n \tconst char *index_name = NULL, *pack_name = NULL;\n \tconst char *keep_name = NULL, *keep_msg = NULL;\n@@ -1000,6 +1027,13 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)\n \t\t\t\tstrict = 1;\n \t\t\t} else if (!strcmp(arg, \"--verify\")) {\n \t\t\t\tverify = 1;\n+\t\t\t} else if (!strcmp(arg, \"--verify-stat\")) {\n+\t\t\t\tverify = 1;\n+\t\t\t\tstat = 1;\n+\t\t\t} else if (!strcmp(arg, \"--verify-stat-only\")) {\n+\t\t\t\tverify = 1;\n+\t\t\t\tstat = 1;\n+\t\t\t\tstat_only = 1;\n \t\t\t} else if (!strcmp(arg, \"--keep\")) {\n \t\t\t\tkeep_msg = \"\";\n \t\t\t} else if (!prefixcmp(arg, \"--keep=\")) {\n@@ -1075,8 +1109,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)\n \n \tcurr_pack = open_pack_file(pack_name);\n \tparse_pack_header();\n-\tobjects = xmalloc((nr_objects + 1) * sizeof(struct object_entry));\n-\tdeltas = xmalloc(nr_objects * sizeof(struct delta_entry));\n+\tobjects = xcalloc(nr_objects + 1, sizeof(struct object_entry));\n+\tdeltas = xcalloc(nr_objects, sizeof(struct delta_entry));\n \tparse_pack_objects(pack_sha1);\n \tif (nr_deltas == nr_resolved_deltas) {\n \t\tstop_progress(&progress);\n@@ -1116,6 +1150,9 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)\n \tif (strict)\n \t\tcheck_objects();\n \n+\tif (stat)\n+\t\tshow_pack_info(stat_only);\n+\n \tidx_objects = xmalloc((nr_objects) * sizeof(struct pack_idx_entry *));\n \tfor (i = 0; i < nr_objects; i++)\n \t\tidx_objects[i] = &objects[i].idx;\n-- \n1.7.6.rc0.106.g68174\n"},{"id":"169279","messageId":"1307140337-27676-4-git-send-email-gitster@pobox.com","threadId":"27541","inReplyTo":"1307140337-27676-1-git-send-email-gitster@pobox.com","subject":"[PATCH 3/4] index-pack: show histogram when emulating \"verify-pack -v\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-03T22:32:16Z","receivedAt":"2011-06-03T22:32:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The histogram produced by \"verify-pack -v\" always had an artificial\nlimit of 50, but index-pack knows what the maximum delta depth is, so\nwe do not have to limit it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * We could limit it, but I do not see a practical value of doing so.\n\n builtin/index-pack.c |   26 +++++++++++++++++++++++---\n 1 files changed, 23 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex aa3c9c6..ed4c3bb 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -70,6 +70,7 @@ static struct progress *progress;\n static unsigned char input_buffer[4096];\n static unsigned int input_offset, input_len;\n static off_t consumed_bytes;\n+static unsigned deepest_delta;\n static git_SHA_CTX input_ctx;\n static uint32_t input_crc32;\n static int input_fd, output_fd, pack_fd;\n@@ -538,6 +539,8 @@ static void resolve_delta(struct object_entry *delta_obj,\n \n \tdelta_obj->real_type = base->obj->real_type;\n \tdelta_obj->delta_depth = base->obj->delta_depth + 1;\n+\tif (deepest_delta < delta_obj->delta_depth)\n+\t\tdeepest_delta = delta_obj->delta_depth;\n \tdelta_obj->base_object_no = base->obj - objects;\n \tdelta_data = get_data_from_pack(delta_obj);\n \tbase_data = get_base_data(base);\n@@ -973,12 +976,17 @@ static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)\n \n static void show_pack_info(int stat_only)\n {\n-\tint i;\n+\tint i, baseobjects = nr_objects - nr_deltas;\n+\tunsigned long *chain_histogram = NULL;\n+\n+\tif (deepest_delta)\n+\t\tchain_histogram = xcalloc(deepest_delta, sizeof(unsigned long));\n+\n \tfor (i = 0; i < nr_objects; i++) {\n \t\tstruct object_entry *obj = &objects[i];\n \n-\t\t/* NEEDSWORK: Compute data necessary for the \"histogram\" here */\n-\n+\t\tif (is_delta_type(obj->type))\n+\t\t\tchain_histogram[obj->delta_depth - 1]++;\n \t\tif (stat_only)\n \t\t\tcontinue;\n \t\tprintf(\"%s %-6s %lu %lu %\"PRIuMAX,\n@@ -992,6 +1000,18 @@ static void show_pack_info(int stat_only)\n \t\t}\n \t\tputchar('\\n');\n \t}\n+\n+\tif (baseobjects)\n+\t\tprintf(\"non delta: %d object%s\\n\",\n+\t\t       baseobjects, baseobjects > 1 ? \"s\" : \"\");\n+\tfor (i = 0; i < deepest_delta; i++) {\n+\t\tif (!chain_histogram[i])\n+\t\t\tcontinue;\n+\t\tprintf(\"chain length = %d: %lu object%s\\n\",\n+\t\t       i + 1,\n+\t\t       chain_histogram[i],\n+\t\t       chain_histogram[i] > 1 ? \"s\" : \"\");\n+\t}\n }\n \n int cmd_index_pack(int argc, const char **argv, const char *prefix)\n-- \n1.7.6.rc0.106.g68174\n"},{"id":"169280","messageId":"1307140337-27676-5-git-send-email-gitster@pobox.com","threadId":"27541","inReplyTo":"1307140337-27676-1-git-send-email-gitster@pobox.com","subject":"[PATCH 4/4] verify-pack: use index-pack --verify","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-03T22:32:17Z","receivedAt":"2011-06-03T22:32:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This finally gets rid of the inefficient verify-pack implementation that\nwalks objects in the packfile in their object name order and replaces it\nwith a call to index-pack --verify. As a side effect, it also removes\npacked_object_info_detail() API which is rather expensive.\n\nAs this changes the way errors are reported (verify-pack used to rely on\nthe usual runtime error detection routine unpack_entry() to diagnose the\nCRC errors in an entry in the *.idx file; index-pack --verify checks the\nwhole *.idx file in one go), update a test that expected the string \"CRC\"\nto appear in the error message.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/verify-pack.c |  132 +++++++++---------------------------------------\n cache.h               |    1 -\n sha1_file.c           |   55 --------------------\n t/t5302-pack-index.sh |    5 +-\n 4 files changed, 27 insertions(+), 166 deletions(-)\n\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex b6079ae..e841b4a 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,134 +1,53 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n-#include \"pack.h\"\n-#include \"pack-revindex.h\"\n+#include \"run-command.h\"\n #include \"parse-options.h\"\n \n-#define MAX_CHAIN 50\n-\n #define VERIFY_PACK_VERBOSE 01\n #define VERIFY_PACK_STAT_ONLY 02\n \n-static void show_pack_info(struct packed_git *p, unsigned int flags)\n-{\n-\tuint32_t nr_objects, i;\n-\tint cnt;\n-\tint stat_only = flags & VERIFY_PACK_STAT_ONLY;\n-\tunsigned long chain_histogram[MAX_CHAIN+1], baseobjects;\n-\n-\tnr_objects = p->num_objects;\n-\tmemset(chain_histogram, 0, sizeof(chain_histogram));\n-\tbaseobjects = 0;\n-\n-\tfor (i = 0; i < nr_objects; i++) {\n-\t\tconst unsigned char *sha1;\n-\t\tunsigned char base_sha1[20];\n-\t\tconst char *type;\n-\t\tunsigned long size;\n-\t\tunsigned long store_size;\n-\t\toff_t offset;\n-\t\tunsigned int delta_chain_length;\n-\n-\t\tsha1 = nth_packed_object_sha1(p, i);\n-\t\tif (!sha1)\n-\t\t\tdie(\"internal error pack-check nth-packed-object\");\n-\t\toffset = nth_packed_object_offset(p, i);\n-\t\ttype = packed_object_info_detail(p, offset, &size, &store_size,\n-\t\t\t\t\t\t &delta_chain_length,\n-\t\t\t\t\t\t base_sha1);\n-\t\tif (!stat_only)\n-\t\t\tprintf(\"%s \", sha1_to_hex(sha1));\n-\t\tif (!delta_chain_length) {\n-\t\t\tif (!stat_only)\n-\t\t\t\tprintf(\"%-6s %lu %lu %\"PRIuMAX\"\\n\",\n-\t\t\t\t       type, size, store_size, (uintmax_t)offset);\n-\t\t\tbaseobjects++;\n-\t\t}\n-\t\telse {\n-\t\t\tif (!stat_only)\n-\t\t\t\tprintf(\"%-6s %lu %lu %\"PRIuMAX\" %u %s\\n\",\n-\t\t\t\t       type, size, store_size, (uintmax_t)offset,\n-\t\t\t\t       delta_chain_length, sha1_to_hex(base_sha1));\n-\t\t\tif (delta_chain_length <= MAX_CHAIN)\n-\t\t\t\tchain_histogram[delta_chain_length]++;\n-\t\t\telse\n-\t\t\t\tchain_histogram[0]++;\n-\t\t}\n-\t}\n-\n-\tif (baseobjects)\n-\t\tprintf(\"non delta: %lu object%s\\n\",\n-\t\t       baseobjects, baseobjects > 1 ? \"s\" : \"\");\n-\n-\tfor (cnt = 1; cnt <= MAX_CHAIN; cnt++) {\n-\t\tif (!chain_histogram[cnt])\n-\t\t\tcontinue;\n-\t\tprintf(\"chain length = %d: %lu object%s\\n\", cnt,\n-\t\t       chain_histogram[cnt],\n-\t\t       chain_histogram[cnt] > 1 ? \"s\" : \"\");\n-\t}\n-\tif (chain_histogram[0])\n-\t\tprintf(\"chain length > %d: %lu object%s\\n\", MAX_CHAIN,\n-\t\t       chain_histogram[0],\n-\t\t       chain_histogram[0] > 1 ? \"s\" : \"\");\n-}\n-\n static int verify_one_pack(const char *path, unsigned int flags)\n {\n-\tchar arg[PATH_MAX];\n-\tint len;\n+\tstruct child_process index_pack;\n+\tconst char *argv[] = {\"index-pack\", NULL, NULL, NULL };\n+\tstruct strbuf arg = STRBUF_INIT;\n \tint verbose = flags & VERIFY_PACK_VERBOSE;\n \tint stat_only = flags & VERIFY_PACK_STAT_ONLY;\n-\tstruct packed_git *pack;\n \tint err;\n \n-\tlen = strlcpy(arg, path, PATH_MAX);\n-\tif (len >= PATH_MAX)\n-\t\treturn error(\"name too long: %s\", path);\n-\n-\t/*\n-\t * In addition to \"foo.idx\" we accept \"foo.pack\" and \"foo\";\n-\t * normalize these forms to \"foo.idx\" for add_packed_git().\n-\t */\n-\tif (has_extension(arg, \".pack\")) {\n-\t\tstrcpy(arg + len - 5, \".idx\");\n-\t\tlen--;\n-\t} else if (!has_extension(arg, \".idx\")) {\n-\t\tif (len + 4 >= PATH_MAX)\n-\t\t\treturn error(\"name too long: %s.idx\", arg);\n-\t\tstrcpy(arg + len, \".idx\");\n-\t\tlen += 4;\n-\t}\n+\tif (stat_only)\n+\t\targv[1] = \"--verify-stat-only\";\n+\telse if (verbose)\n+\t\targv[1] = \"--verify-stat\";\n+\telse\n+\t\targv[1] = \"--verify\";\n \n \t/*\n-\t * add_packed_git() uses our buffer (containing \"foo.idx\") to\n-\t * build the pack filename (\"foo.pack\").  Make sure it fits.\n+\t * In addition to \"foo.pack\" we accept \"foo.idx\" and \"foo\";\n+\t * normalize these forms to \"foo.pack\" for \"index-pack --verify\".\n \t */\n-\tif (len + 1 >= PATH_MAX) {\n-\t\targ[len - 4] = '\\0';\n-\t\treturn error(\"name too long: %s.pack\", arg);\n-\t}\n-\n-\tpack = add_packed_git(arg, len, 1);\n-\tif (!pack)\n-\t\treturn error(\"packfile %s not found.\", arg);\n+\tstrbuf_addstr(&arg, path);\n+\tif (has_extension(arg.buf, \".idx\"))\n+\t\tstrbuf_splice(&arg, arg.len - 3, 3, \"pack\", 4);\n+\telse if (!has_extension(arg.buf, \".pack\"))\n+\t\tstrbuf_add(&arg, \".pack\", 5);\n+\targv[2] = arg.buf;\n \n-\tinstall_packed_git(pack);\n+\tmemset(&index_pack, 0, sizeof(index_pack));\n+\tindex_pack.argv = argv;\n+\tindex_pack.git_cmd = 1;\n \n-\tif (!stat_only)\n-\t\terr = verify_pack(pack);\n-\telse\n-\t\terr = open_pack_index(pack);\n+\terr = run_command(&index_pack);\n \n \tif (verbose || stat_only) {\n \t\tif (err)\n-\t\t\tprintf(\"%s: bad\\n\", pack->pack_name);\n+\t\t\tprintf(\"%s: bad\\n\", arg.buf);\n \t\telse {\n-\t\t\tshow_pack_info(pack, flags);\n \t\t\tif (!stat_only)\n-\t\t\t\tprintf(\"%s: ok\\n\", pack->pack_name);\n+\t\t\t\tprintf(\"%s: ok\\n\", arg.buf);\n \t\t}\n \t}\n+\tstrbuf_release(&arg);\n \n \treturn err;\n }\n@@ -159,7 +78,6 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix)\n \tfor (i = 0; i < argc; i++) {\n \t\tif (verify_one_pack(argv[i], flags))\n \t\t\terr = 1;\n-\t\tdiscard_revindex();\n \t}\n \n \treturn err;\ndiff --git a/cache.h b/cache.h\nindex 08a9022..edea69e 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -991,7 +991,6 @@ extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *);\n extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *);\n extern unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);\n extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);\n-extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);\n \n /* Dumb servers support */\n extern int update_server_info(int);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex d949b35..ca87e3d 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1496,61 +1496,6 @@ static int unpack_object_header(struct packed_git *p,\n \treturn type;\n }\n \n-const char *packed_object_info_detail(struct packed_git *p,\n-\t\t\t\t      off_t obj_offset,\n-\t\t\t\t      unsigned long *size,\n-\t\t\t\t      unsigned long *store_size,\n-\t\t\t\t      unsigned int *delta_chain_length,\n-\t\t\t\t      unsigned char *base_sha1)\n-{\n-\tstruct pack_window *w_curs = NULL;\n-\toff_t curpos;\n-\tunsigned long dummy;\n-\tunsigned char *next_sha1;\n-\tenum object_type type;\n-\tstruct revindex_entry *revidx;\n-\n-\t*delta_chain_length = 0;\n-\tcurpos = obj_offset;\n-\ttype = unpack_object_header(p, &w_curs, &curpos, size);\n-\n-\trevidx = find_pack_revindex(p, obj_offset);\n-\t*store_size = revidx[1].offset - obj_offset;\n-\n-\tfor (;;) {\n-\t\tswitch (type) {\n-\t\tdefault:\n-\t\t\tdie(\"pack %s contains unknown object type %d\",\n-\t\t\t    p->pack_name, type);\n-\t\tcase OBJ_COMMIT:\n-\t\tcase OBJ_TREE:\n-\t\tcase OBJ_BLOB:\n-\t\tcase OBJ_TAG:\n-\t\t\tunuse_pack(&w_curs);\n-\t\t\treturn typename(type);\n-\t\tcase OBJ_OFS_DELTA:\n-\t\t\tobj_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);\n-\t\t\tif (!obj_offset)\n-\t\t\t\tdie(\"pack %s contains bad delta base reference of type %s\",\n-\t\t\t\t    p->pack_name, typename(type));\n-\t\t\tif (*delta_chain_length == 0) {\n-\t\t\t\trevidx = find_pack_revindex(p, obj_offset);\n-\t\t\t\thashcpy(base_sha1, nth_packed_object_sha1(p, revidx->nr));\n-\t\t\t}\n-\t\t\tbreak;\n-\t\tcase OBJ_REF_DELTA:\n-\t\t\tnext_sha1 = use_pack(p, &w_curs, curpos, NULL);\n-\t\t\tif (*delta_chain_length == 0)\n-\t\t\t\thashcpy(base_sha1, next_sha1);\n-\t\t\tobj_offset = find_pack_entry_one(next_sha1, p);\n-\t\t\tbreak;\n-\t\t}\n-\t\t(*delta_chain_length)++;\n-\t\tcurpos = obj_offset;\n-\t\ttype = unpack_object_header(p, &w_curs, &curpos, &dummy);\n-\t}\n-}\n-\n static int packed_object_info(struct packed_git *p, off_t obj_offset,\n \t\t\t      unsigned long *sizep)\n {\ndiff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh\nindex 76bcaca..f8fa924 100755\n--- a/t/t5302-pack-index.sh\n+++ b/t/t5302-pack-index.sh\n@@ -226,9 +226,8 @@ test_expect_success \\\n      ( while read obj\n        do git cat-file -p $obj >/dev/null || exit 1\n        done <obj-list ) &&\n-     err=$(test_must_fail git verify-pack \\\n-       \".git/objects/pack/pack-${pack1}.pack\" 2>&1) &&\n-     echo \"$err\" | grep \"CRC mismatch\"'\n+     test_must_fail git verify-pack \".git/objects/pack/pack-${pack1}.pack\"\n+'\n \n test_expect_success 'running index-pack in the object store' '\n     rm -f .git/objects/pack/* &&\n-- \n1.7.6.rc0.106.g68174\n"}]}