{"thread":{"id":"5635","subject":"[PATCH 1/6] move pack creation to version 3","startedAt":"2006-09-21T04:11:59Z","lastAt":"2006-09-21T04:11:59Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"27333","messageId":"Pine.LNX.4.64.0609210011300.2627@xanadu.home","threadId":"5635","inReplyTo":null,"subject":"[PATCH 1/6] move pack creation to version 3","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2006-09-21T04:11:59Z","receivedAt":"2006-09-21T04:11:59Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"It's been quite a while now that GIT is able to read version 3 packs.\nLet's create them at last.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n\ndiff --git a/diff-delta.c b/diff-delta.c\nindex fa16d06..51df460 100644\n--- a/diff-delta.c\n+++ b/diff-delta.c\n@@ -308,8 +308,8 @@ create_delta(const struct delta_index *i\n \t\t\t\tcontinue;\n \t\t\tif (ref_size > top - src)\n \t\t\t\tref_size = top - src;\n-\t\t\tif (ref_size > 0x10000)\n-\t\t\t\tref_size = 0x10000;\n+\t\t\tif (ref_size > 0xffffff)\n+\t\t\t\tref_size = 0xffffff;\n \t\t\tif (ref_size <= msize)\n \t\t\t\tbreak;\n \t\t\twhile (ref_size-- && *src++ == *ref)\n@@ -318,6 +318,8 @@ create_delta(const struct delta_index *i\n \t\t\t\t/* this is our best match so far */\n \t\t\t\tmsize = ref - entry->ptr;\n \t\t\t\tmoff = entry->ptr - ref_data;\n+\t\t\t\tif (msize >= 0x10000)\n+\t\t\t\t\tbreak;  /* this is good enough */\n \t\t\t}\n \t\t}\n \n@@ -381,6 +383,8 @@ create_delta(const struct delta_index *i\n \t\t\tif (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }\n \t\t\tmsize >>= 8;\n \t\t\tif (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }\n+\t\t\tmsize >>= 8;\n+\t\t\tif (msize & 0xff) { out[outpos++] = msize; i |= 0x40; }\n \n \t\t\t*op = i;\n \t\t}\ndiff --git a/pack.h b/pack.h\nindex eb07b03..05557da 100644\n--- a/pack.h\n+++ b/pack.h\n@@ -7,7 +7,7 @@ #include \"object.h\"\n  * Packed object header\n  */\n #define PACK_SIGNATURE 0x5041434b\t/* \"PACK\" */\n-#define PACK_VERSION 2\n+#define PACK_VERSION 3\n #define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))\n struct pack_header {\n \tunsigned int hdr_signature;\n"}]}