Skip to content

Commit 1685457

Browse files
Nicolas PitreJunio C Hamano
authored andcommitted
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>
1 parent 3d5c0cc commit 1685457

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

diff-delta.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ create_delta(const struct delta_index *index,
308308
continue;
309309
if (ref_size > top - src)
310310
ref_size = top - src;
311-
if (ref_size > 0x10000)
312-
ref_size = 0x10000;
311+
if (ref_size > 0xffffff)
312+
ref_size = 0xffffff;
313313
if (ref_size <= msize)
314314
break;
315315
while (ref_size-- && *src++ == *ref)
@@ -318,6 +318,8 @@ create_delta(const struct delta_index *index,
318318
/* this is our best match so far */
319319
msize = ref - entry->ptr;
320320
moff = entry->ptr - ref_data;
321+
if (msize >= 0x10000)
322+
break; /* this is good enough */
321323
}
322324
}
323325

@@ -381,6 +383,8 @@ create_delta(const struct delta_index *index,
381383
if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
382384
msize >>= 8;
383385
if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
386+
msize >>= 8;
387+
if (msize & 0xff) { out[outpos++] = msize; i |= 0x40; }
384388

385389
*op = i;
386390
}

pack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Packed object header
88
*/
99
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
10-
#define PACK_VERSION 2
10+
#define PACK_VERSION 3
1111
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
1212
struct pack_header {
1313
unsigned int hdr_signature;

0 commit comments

Comments
 (0)