mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
![Nicolas Pitre](/assets/img/avatar_default.png)
After experimenting with code to add the ability to encode a delta against part of the deltified file, it turns out that resulting packs are _bigger_ than when this ability is not used. The raw delta output might be smaller, but it doesn't compress as well using gzip with a negative net saving on average. Said bit would in fact be more useful to allow for encoding the copying of chunks larger than 64KB providing more savings with large files. This will correspond to packs version 3. While the current code still produces packs version 2, it is made future proof so pack versions 2 and 3 are accepted. Any pack version 2 are compatible with version 3 since the redefined bit was never used before. When enough time has passed, code to use that bit to produce version 3 packs could be added. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
34 lines
682 B
C
34 lines
682 B
C
#ifndef PACK_H
|
|
#define PACK_H
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
enum object_type {
|
|
OBJ_EXT = 0,
|
|
OBJ_COMMIT = 1,
|
|
OBJ_TREE = 2,
|
|
OBJ_BLOB = 3,
|
|
OBJ_TAG = 4,
|
|
/* 5/6 for future expansion */
|
|
OBJ_DELTA = 7,
|
|
};
|
|
|
|
/*
|
|
* Packed object header
|
|
*/
|
|
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
|
|
#define PACK_VERSION 2
|
|
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
|
|
struct pack_header {
|
|
unsigned int hdr_signature;
|
|
unsigned int hdr_version;
|
|
unsigned int hdr_entries;
|
|
};
|
|
|
|
extern int verify_pack(struct packed_git *, int);
|
|
|
|
#endif
|