Skip to content

Commit

Permalink
move pack creation to version 3
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Nicolas Pitre authored and Junio C Hamano committed Sep 23, 2006
1 parent 3d5c0cc commit 1685457
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions diff-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ create_delta(const struct delta_index *index,
continue;
if (ref_size > top - src)
ref_size = top - src;
if (ref_size > 0x10000)
ref_size = 0x10000;
if (ref_size > 0xffffff)
ref_size = 0xffffff;
if (ref_size <= msize)
break;
while (ref_size-- && *src++ == *ref)
Expand All @@ -318,6 +318,8 @@ create_delta(const struct delta_index *index,
/* this is our best match so far */
msize = ref - entry->ptr;
moff = entry->ptr - ref_data;
if (msize >= 0x10000)
break; /* this is good enough */
}
}

Expand Down Expand Up @@ -381,6 +383,8 @@ create_delta(const struct delta_index *index,
if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
msize >>= 8;
if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
msize >>= 8;
if (msize & 0xff) { out[outpos++] = msize; i |= 0x40; }

*op = i;
}
Expand Down
2 changes: 1 addition & 1 deletion pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Packed object header
*/
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
#define PACK_VERSION 2
#define PACK_VERSION 3
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
struct pack_header {
unsigned int hdr_signature;
Expand Down

0 comments on commit 1685457

Please sign in to comment.