Merge branch 'tb/cruft-packs'
A mechanism to pack unreachable objects into a "cruft pack", instead of ejecting them into loose form to be reclaimed later, has been introduced. * tb/cruft-packs: sha1-file.c: don't freshen cruft packs builtin/gc.c: conditionally avoid pruning objects via loose builtin/repack.c: add cruft packs to MIDX during geometric repack builtin/repack.c: use named flags for existing_packs builtin/repack.c: allow configuring cruft pack generation builtin/repack.c: support generating a cruft pack builtin/pack-objects.c: --cruft with expiration reachable: report precise timestamps from objects in cruft packs reachable: add options to add_unseen_recent_objects_to_traversal builtin/pack-objects.c: --cruft without expiration builtin/pack-objects.c: return from create_object_entry() t/helper: add 'pack-mtimes' test-tool pack-mtimes: support writing pack .mtimes files chunk-format.h: extract oid_version() pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles' pack-mtimes: support reading .mtimes files Documentation/technical: add cruft-packs.txt
This commit is contained in:
18
midx.c
18
midx.c
@ -41,18 +41,6 @@
|
||||
|
||||
#define PACK_EXPIRED UINT_MAX
|
||||
|
||||
static uint8_t oid_version(void)
|
||||
{
|
||||
switch (hash_algo_by_ptr(the_hash_algo)) {
|
||||
case GIT_HASH_SHA1:
|
||||
return 1;
|
||||
case GIT_HASH_SHA256:
|
||||
return 2;
|
||||
default:
|
||||
die(_("invalid hash version"));
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned char *get_midx_checksum(struct multi_pack_index *m)
|
||||
{
|
||||
return m->data + m->data_len - the_hash_algo->rawsz;
|
||||
@ -134,9 +122,9 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local
|
||||
m->version);
|
||||
|
||||
hash_version = m->data[MIDX_BYTE_HASH_VERSION];
|
||||
if (hash_version != oid_version()) {
|
||||
if (hash_version != oid_version(the_hash_algo)) {
|
||||
error(_("multi-pack-index hash version %u does not match version %u"),
|
||||
hash_version, oid_version());
|
||||
hash_version, oid_version(the_hash_algo));
|
||||
goto cleanup_fail;
|
||||
}
|
||||
m->hash_len = the_hash_algo->rawsz;
|
||||
@ -420,7 +408,7 @@ static size_t write_midx_header(struct hashfile *f,
|
||||
{
|
||||
hashwrite_be32(f, MIDX_SIGNATURE);
|
||||
hashwrite_u8(f, MIDX_VERSION);
|
||||
hashwrite_u8(f, oid_version());
|
||||
hashwrite_u8(f, oid_version(the_hash_algo));
|
||||
hashwrite_u8(f, num_chunks);
|
||||
hashwrite_u8(f, 0); /* unused */
|
||||
hashwrite_be32(f, num_packs);
|
||||
|
Reference in New Issue
Block a user