{"thread":{"id":"7586","subject":"[PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","startedAt":"2007-04-09T21:32:03Z","lastAt":"2007-04-10T13:23:29Z","messageCount":8,"participants":["Nicolas Pitre","Bill Lear","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"38952","messageId":"alpine.LFD.0.98.0704091727300.28181@xanadu.home","threadId":"7586","inReplyTo":null,"subject":"[PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-04-09T21:32:03Z","receivedAt":"2007-04-09T21:32:03Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"This is necessary for testing the new capabilities in some automated \nway without having an actual 4GB+ pack.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n\nI should write some tests... when I have more time.\n\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 8cf2871..099dea0 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -597,6 +597,9 @@ static off_t write_pack_file(void)\n \treturn last_obj_offset;\n }\n \n+static uint32_t index_default_version = 1;\n+static uint32_t index_off32_limit = 0x7fffffff;\n+\n static void write_index_file(off_t last_obj_offset)\n {\n \tuint32_t i;\n@@ -608,7 +611,7 @@ static void write_index_file(off_t last_obj_offset)\n \tuint32_t index_version;\n \n \t/* if last object's offset is >= 2^31 we should use index V2 */\n-\tindex_version = (last_obj_offset >> 31) ? 2 : 1;\n+\tindex_version = (last_obj_offset >> 31) ? 2 : index_default_version;\n \n \t/* index versions 2 and above need a header */\n \tif (index_version >= 2) {\n@@ -664,7 +667,7 @@ static void write_index_file(off_t last_obj_offset)\n \t\tlist = sorted_by_sha;\n \t\tfor (i = 0; i < nr_objects; i++) {\n \t\t\tstruct object_entry *entry = *list++;\n-\t\t\tuint32_t offset = (entry->offset <= 0x7fffffff) ?\n+\t\t\tuint32_t offset = (entry->offset <= index_off32_limit) ?\n \t\t\t\tentry->offset : (0x80000000 | nr_large_offset++);\n \t\t\toffset = htonl(offset);\n \t\t\tsha1write(f, &offset, 4);\n@@ -675,7 +678,7 @@ static void write_index_file(off_t last_obj_offset)\n \t\twhile (nr_large_offset) {\n \t\t\tstruct object_entry *entry = *list++;\n \t\t\tuint64_t offset = entry->offset;\n-\t\t\tif (offset > 0x7fffffff) {\n+\t\t\tif (offset > index_off32_limit) {\n \t\t\t\tuint32_t split[2];\n \t\t\t\tsplit[0]        = htonl(offset >> 32);\n \t\t\t\tsplit[1] = htonl(offset & 0xffffffff);\n@@ -1714,6 +1717,17 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \t\t\trp_av[1] = \"--objects-edge\";\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!prefixcmp(arg, \"--index-version=\")) {\n+\t\t\tchar *c;\n+\t\t\tindex_default_version = strtoul(arg + 16, &c, 10);\n+\t\t\tif (index_default_version > 2)\n+\t\t\t\tdie(\"bad %s\", arg);\n+\t\t\tif (*c == ',')\n+\t\t\t\tindex_off32_limit = strtoul(c+1, &c, 0);\n+\t\t\tif (*c || index_off32_limit & 0x80000000)\n+\t\t\t\tdie(\"bad %s\", arg);\n+\t\t\tcontinue;\n+\t\t}\n \t\tusage(pack_usage);\n \t}\n \ndiff --git a/index-pack.c b/index-pack.c\nindex a833f64..7aad261 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -671,6 +671,9 @@ static void readjust_pack_header_and_sha1(unsigned char *sha1)\n \twrite_or_die(output_fd, sha1, 20);\n }\n \n+static uint32_t index_default_version = 1;\n+static uint32_t index_off32_limit = 0x7fffffff;\n+\n static int sha1_compare(const void *_a, const void *_b)\n {\n \tstruct object_entry *a = *(struct object_entry **)_a;\n@@ -719,7 +722,7 @@ static const char *write_index_file(const char *index_name, unsigned char *sha1)\n \tf = sha1fd(fd, index_name);\n \n \t/* if last object's offset is >= 2^31 we should use index V2 */\n-\tindex_version = (objects[nr_objects-1].offset >> 31) ? 2 : 1;\n+\tindex_version = (objects[nr_objects-1].offset >> 31) ? 2 : index_default_version;\n \n \t/* index versions 2 and above need a header */\n \tif (index_version >= 2) {\n@@ -779,7 +782,7 @@ static const char *write_index_file(const char *index_name, unsigned char *sha1)\n \t\tlist = sorted_by_sha;\n \t\tfor (i = 0; i < nr_objects; i++) {\n \t\t\tstruct object_entry *obj = *list++;\n-\t\t\tuint32_t offset = (obj->offset <= 0x7fffffff) ?\n+\t\t\tuint32_t offset = (obj->offset <= index_off32_limit) ?\n \t\t\t\tobj->offset : (0x80000000 | nr_large_offset++);\n \t\t\toffset = htonl(offset);\n \t\t\tsha1write(f, &offset, 4);\n@@ -790,7 +793,7 @@ static const char *write_index_file(const char *index_name, unsigned char *sha1)\n \t\twhile (nr_large_offset) {\n \t\t\tstruct object_entry *obj = *list++;\n \t\t\tuint64_t offset = obj->offset;\n-\t\t\tif (offset > 0x7fffffff) {\n+\t\t\tif (offset > index_off32_limit) {\n \t\t\t\tuint32_t split[2];\n \t\t\t\tsplit[0]\t= htonl(offset >> 32);\n \t\t\t\tsplit[1] = htonl(offset & 0xffffffff);\n@@ -929,6 +932,15 @@ int main(int argc, char **argv)\n \t\t\t\tif (index_name || (i+1) >= argc)\n \t\t\t\t\tusage(index_pack_usage);\n \t\t\t\tindex_name = argv[++i];\n+\t\t\t} else if (!prefixcmp(arg, \"--index-version=\")) {\n+\t\t\t\tchar *c;\n+\t\t\t\tindex_default_version = strtoul(arg + 16, &c, 10);\n+\t\t\t\tif (index_default_version > 2)\n+\t\t\t\t\tdie(\"bad %s\", arg);\n+\t\t\t\tif (*c == ',')\n+\t\t\t\t\tindex_off32_limit = strtoul(c+1, &c, 0);\n+\t\t\t\tif (*c || index_off32_limit & 0x80000000)\n+\t\t\t\t\tdie(\"bad %s\", arg);\n \t\t\t} else\n \t\t\t\tusage(index_pack_usage);\n \t\t\tcontinue;\nddiff --git a/t/Makefile b/t/Makefile\n"},{"id":"38979","messageId":"7vps6dxjvb.fsf@assigned-by-dhcp.cox.net","threadId":"7586","inReplyTo":"alpine.LFD.0.98.0704091727300.28181@xanadu.home","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T22:28:56Z","receivedAt":"2007-04-09T22:28:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@cam.org> writes:\n\n> This is necessary for testing the new capabilities in some automated \n> way without having an actual 4GB+ pack.\n>\n> Signed-off-by: Nicolas Pitre <nico@cam.org>\n> ---\n>\n> I should write some tests... when I have more time.\n\nIt appears everybody is short of time.  I am having two\ntroubles.  Nobody seems to have positive nor negative reports or\ncomments on what are cooking in 'next' so nothing can graduate,\nand I am behind list discussions on certain areas myself.\n\n> ddiff --git a/t/Makefile b/t/Makefile\n\n???\n"},{"id":"38977","messageId":"17946.48924.250109.753444@lisa.zopyra.com","threadId":"7586","inReplyTo":"7vps6dxjvb.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-04-09T22:33:00Z","receivedAt":"2007-04-09T22:33:00Z","isPatch":true,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Monday, April 9, 2007 at 15:28:56 (-0700) Junio C Hamano writes:\n>Nicolas Pitre <nico@cam.org> writes:\n>>...\n>> I should write some tests... when I have more time.\n>\n>It appears everybody is short of time.  I am having two\n>troubles.  Nobody seems to have positive nor negative reports or\n>comments on what are cooking in 'next' so nothing can graduate,\n>and I am behind list discussions on certain areas myself.\n\nHave you considered a git holiday?  Just black out the calendar for a\nweek every once in a while to allow people to catch up on their \"real\"\njobs, and allow things to settle?\n\n\nBill\n"},{"id":"38974","messageId":"alpine.LFD.0.98.0704091901290.28181@xanadu.home","threadId":"7586","inReplyTo":"7vps6dxjvb.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-04-09T23:04:52Z","receivedAt":"2007-04-09T23:04:52Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Mon, 9 Apr 2007, Junio C Hamano wrote:\n\n> Nicolas Pitre <nico@cam.org> writes:\n> \n> > This is necessary for testing the new capabilities in some automated \n> > way without having an actual 4GB+ pack.\n> >\n> > Signed-off-by: Nicolas Pitre <nico@cam.org>\n> > ---\n> >\n> > I should write some tests... when I have more time.\n> \n> It appears everybody is short of time.  I am having two\n> troubles.  Nobody seems to have positive nor negative reports or\n> comments on what are cooking in 'next' so nothing can graduate,\n> and I am behind list discussions on certain areas myself.\n\nAt least my latest patch series received two positive reviews.  ;-)\n\n> > ddiff --git a/t/Makefile b/t/Makefile\n> \n> ???\n\nRemnant of a change to that file which was later reverted but mtime \ndoesn't match the index.\n\n\nNicolas\n"},{"id":"38980","messageId":"7vejmtxekj.fsf@assigned-by-dhcp.cox.net","threadId":"7586","inReplyTo":"alpine.LFD.0.98.0704091901290.28181@xanadu.home","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-10T00:23:24Z","receivedAt":"2007-04-10T00:23:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@cam.org> writes:\n\n> On Mon, 9 Apr 2007, Junio C Hamano wrote:\n>\n>> Nicolas Pitre <nico@cam.org> writes:\n>> \n>> > This is necessary for testing the new capabilities in some automated \n>> > way without having an actual 4GB+ pack.\n>> >\n>> > Signed-off-by: Nicolas Pitre <nico@cam.org>\n>> > ---\n>> >\n>> > I should write some tests... when I have more time.\n>> \n>> It appears everybody is short of time.  I am having two\n>> troubles.  Nobody seems to have positive nor negative reports or\n>> comments on what are cooking in 'next' so nothing can graduate,\n>> and I am behind list discussions on certain areas myself.\n>\n> At least my latest patch series received two positive reviews.  ;-)\n\nThey are _not_ even in 'pu'.  I am talking about things that\nhave been cooking.\n\n>> > ddiff --git a/t/Makefile b/t/Makefile\n>> \n>> ???\n>\n> Remnant of a change to that file which was later reverted but mtime \n> doesn't match the index.\n\nDouble 'd'?\n"},{"id":"38981","messageId":"alpine.LFD.0.98.0704092046080.28181@xanadu.home","threadId":"7586","inReplyTo":"7vejmtxekj.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-04-10T01:03:35Z","receivedAt":"2007-04-10T01:03:35Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Mon, 9 Apr 2007, Junio C Hamano wrote:\n\n> Nicolas Pitre <nico@cam.org> writes:\n> \n> > On Mon, 9 Apr 2007, Junio C Hamano wrote:\n> >\n> >> It appears everybody is short of time.  I am having two\n> >> troubles.  Nobody seems to have positive nor negative reports or\n> >> comments on what are cooking in 'next' so nothing can graduate,\n> >> and I am behind list discussions on certain areas myself.\n> >\n> > At least my latest patch series received two positive reviews.  ;-)\n> \n> They are _not_ even in 'pu'.  I am talking about things that\n> have been cooking.\n\nRemember that positive comments are by default much less verbose than \nnegative ones. In other words, no news is probably good news.\n\n> >> > ddiff --git a/t/Makefile b/t/Makefile\n> >> \n> >> ???\n\n$ touch t/Makefile\n$ git diff\n\n\nNicolas\n"},{"id":"38993","messageId":"7vlkh0wur7.fsf@assigned-by-dhcp.cox.net","threadId":"7586","inReplyTo":"alpine.LFD.0.98.0704092046080.28181@xanadu.home","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-10T07:31:24Z","receivedAt":"2007-04-10T07:31:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@cam.org> writes:\n\n>> They are _not_ even in 'pu'.  I am talking about things that\n>> have been cooking.\n>\n> Remember that positive comments are by default much less verbose than \n> negative ones. In other words, no news is probably good news.\n\nNo news means one or more of the following:\n\n - Immediately before 1.5.1, people were asked to test 'master'\n   rigorously, and they did, and they are still on 'master'.\n   Nobody noticed breakages in 'next'.\n\n - Some people use 'next' but the new features, fixes or\n   enhancements the topics introduce are totally irrelevant to\n   how they use git, so problems are not noticed.  This would\n   indicate that some of the topics may not even deserve to\n   be in 'next'.\n\n - Most people are generally 'wait and see' and even when warned\n   that some new features cooking in 'next' may change the user\n   experience (even in good ways), they do not try to see if the\n   change may adversely affect them to voice their objection\n   early, to catch the changes they do not like before they\n   graduate to 'master', and then complain.  This would indicate\n   that it is futile to have 'next' as a holding area.  It would\n   be more effective to push out unproven stuff on 'master' to\n   make sure people complain.\n\nNone of the above does not sound a good news at all to me.\n\n>> >> > ddiff --git a/t/Makefile b/t/Makefile\n>> >> \n>> >> ???\n>\n> $ touch t/Makefile\n> $ git diff\n\nThis still does not give me doubled d in diff.\n"},{"id":"39014","messageId":"alpine.LFD.0.98.0704100920500.28181@xanadu.home","threadId":"7586","inReplyTo":"7vlkh0wur7.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 11/10] allow forcing index v2 and 64-bit offset treshold","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-04-10T13:23:29Z","receivedAt":"2007-04-10T13:23:29Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Tue, 10 Apr 2007, Junio C Hamano wrote:\n\n> Nicolas Pitre <nico@cam.org> writes:\n> \n> >> >> > ddiff --git a/t/Makefile b/t/Makefile\n> >> >> \n> >> >> ???\n> >\n> > $ touch t/Makefile\n> > $ git diff\n> \n> This still does not give me doubled d in diff.\n\nAh!  Maybe I tried to delete it ('dd' in vi) and screwed it somehow.\n\n\nNicolas\n"}]}