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>
This commit is contained in:

committed by
Junio C Hamano

parent
3d5c0cc938
commit
16854571aa
@ -308,8 +308,8 @@ create_delta(const struct delta_index *index,
|
|||||||
continue;
|
continue;
|
||||||
if (ref_size > top - src)
|
if (ref_size > top - src)
|
||||||
ref_size = top - src;
|
ref_size = top - src;
|
||||||
if (ref_size > 0x10000)
|
if (ref_size > 0xffffff)
|
||||||
ref_size = 0x10000;
|
ref_size = 0xffffff;
|
||||||
if (ref_size <= msize)
|
if (ref_size <= msize)
|
||||||
break;
|
break;
|
||||||
while (ref_size-- && *src++ == *ref)
|
while (ref_size-- && *src++ == *ref)
|
||||||
@ -318,6 +318,8 @@ create_delta(const struct delta_index *index,
|
|||||||
/* this is our best match so far */
|
/* this is our best match so far */
|
||||||
msize = ref - entry->ptr;
|
msize = ref - entry->ptr;
|
||||||
moff = entry->ptr - ref_data;
|
moff = entry->ptr - ref_data;
|
||||||
|
if (msize >= 0x10000)
|
||||||
|
break; /* this is good enough */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,6 +383,8 @@ create_delta(const struct delta_index *index,
|
|||||||
if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
|
if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
|
||||||
msize >>= 8;
|
msize >>= 8;
|
||||||
if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
|
if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
|
||||||
|
msize >>= 8;
|
||||||
|
if (msize & 0xff) { out[outpos++] = msize; i |= 0x40; }
|
||||||
|
|
||||||
*op = i;
|
*op = i;
|
||||||
}
|
}
|
||||||
|
2
pack.h
2
pack.h
@ -7,7 +7,7 @@
|
|||||||
* Packed object header
|
* Packed object header
|
||||||
*/
|
*/
|
||||||
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
|
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
|
||||||
#define PACK_VERSION 2
|
#define PACK_VERSION 3
|
||||||
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
|
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
|
||||||
struct pack_header {
|
struct pack_header {
|
||||||
unsigned int hdr_signature;
|
unsigned int hdr_signature;
|
||||||
|
Reference in New Issue
Block a user