@matheusbsbs / matheus-bagliano / commits / 16854571aa
Fork 0

move pack creation to version 3

It's been quite a while now that GIT is able to read version 3 packs. Let's create them at last. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Nicolas Pitre committed Sep 21, 2006 at 00:11 UTC 16854571aae6302f457c5fbee41ac64669b09595
2 files changed +7 -3
diff-delta.c
+6 -2
@@ -308,8 +308,8 @@ create_delta(const struct delta_index *index,
308 continue;
309 if (ref_size > top - src)
310 ref_size = top - src;
311 - if (ref_size > 0x10000)
312 - ref_size = 0x10000;
311 + if (ref_size > 0xffffff)
312 + ref_size = 0xffffff;
313 if (ref_size <= msize)
314 break;
315 while (ref_size-- && *src++ == *ref)
@@ -318,6 +318,8 @@ create_delta(const struct delta_index *index,
318 /* this is our best match so far */
319 msize = ref - entry->ptr;
320 moff = entry->ptr - ref_data;
321 + if (msize >= 0x10000)
322 + break; /* this is good enough */
323 }
324 }
325
@@ -381,6 +383,8 @@ create_delta(const struct delta_index *index,
383 if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
384 msize >>= 8;
385 if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
386 + msize >>= 8;
387 + if (msize & 0xff) { out[outpos++] = msize; i |= 0x40; }
388
389 *op = i;
390 }
pack.h
+1 -1
@@ -7,7 +7,7 @@
7 * Packed object header
8 */
9 #define PACK_SIGNATURE 0x5041434b /* "PACK" */
10 -#define PACK_VERSION 2
10 +#define PACK_VERSION 3
11 #define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
12 struct pack_header {
13 unsigned int hdr_signature;