2005-06-29 05:21:02 +08:00
|
|
|
#ifndef PACK_H
|
|
|
|
#define PACK_H
|
|
|
|
|
2005-06-29 13:15:57 +08:00
|
|
|
/*
|
|
|
|
* The packed object type is stored in 3 bits.
|
|
|
|
* The type value 0 is a reserved prefix if ever there is more than 7
|
|
|
|
* object types, or any future format extensions.
|
|
|
|
*/
|
2005-06-29 05:21:02 +08:00
|
|
|
enum object_type {
|
2005-06-29 13:15:57 +08:00
|
|
|
OBJ_EXT = 0,
|
|
|
|
OBJ_COMMIT = 1,
|
|
|
|
OBJ_TREE = 2,
|
|
|
|
OBJ_BLOB = 3,
|
|
|
|
OBJ_TAG = 4,
|
|
|
|
/* 5/6 for future expansion */
|
|
|
|
OBJ_DELTA = 7,
|
2005-06-29 05:21:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Packed object header
|
|
|
|
*/
|
|
|
|
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
|
2005-06-29 13:15:57 +08:00
|
|
|
#define PACK_VERSION 2
|
2006-02-10 06:50:04 +08:00
|
|
|
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
|
2005-06-29 05:21:02 +08:00
|
|
|
struct pack_header {
|
|
|
|
unsigned int hdr_signature;
|
|
|
|
unsigned int hdr_version;
|
|
|
|
unsigned int hdr_entries;
|
|
|
|
};
|
|
|
|
|
2005-07-01 08:15:39 +08:00
|
|
|
extern int verify_pack(struct packed_git *, int);
|
pack-objects: reuse data from existing packs.
When generating a new pack, notice if we have already needed
objects in existing packs. If an object is stored deltified,
and its base object is also what we are going to pack, then
reuse the existing deltified representation unconditionally,
bypassing all the expensive find_deltas() and try_deltas()
calls.
Also, notice if what we are going to write out exactly match
what is already in an existing pack (either deltified or just
compressed). In such a case, we can just copy it instead of
going through the usual uncompressing & recompressing cycle.
Without this patch, in linux-2.6 repository with about 1500
loose objects and a single mega pack:
$ git-rev-list --objects v2.6.16-rc3 >RL
$ wc -l RL
184141 RL
$ time git-pack-objects p <RL
Generating pack...
Done counting 184141 objects.
Packing 184141 objects....................
a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
real 12m4.323s
user 11m2.560s
sys 0m55.950s
With this patch, the same input:
$ time ../git.junio/git-pack-objects q <RL
Generating pack...
Done counting 184141 objects.
Packing 184141 objects.....................
a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
Total 184141, written 184141, reused 182441
real 1m2.608s
user 0m55.090s
sys 0m1.830s
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-16 09:34:29 +08:00
|
|
|
extern int check_reuse_pack_delta(struct packed_git *, unsigned long,
|
|
|
|
unsigned char *, unsigned long *,
|
|
|
|
enum object_type *);
|
2005-06-29 05:21:02 +08:00
|
|
|
#endif
|