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:
@ -193,18 +193,6 @@ char *get_commit_graph_chain_filename(struct object_directory *odb)
|
||||
return xstrfmt("%s/info/commit-graphs/commit-graph-chain", odb->path);
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
static struct commit_graph *alloc_commit_graph(void)
|
||||
{
|
||||
struct commit_graph *g = xcalloc(1, sizeof(*g));
|
||||
@ -365,9 +353,9 @@ struct commit_graph *parse_commit_graph(struct repository *r,
|
||||
}
|
||||
|
||||
hash_version = *(unsigned char*)(data + 5);
|
||||
if (hash_version != oid_version()) {
|
||||
if (hash_version != oid_version(the_hash_algo)) {
|
||||
error(_("commit-graph hash version %X does not match version %X"),
|
||||
hash_version, oid_version());
|
||||
hash_version, oid_version(the_hash_algo));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1924,7 +1912,7 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
|
||||
hashwrite_be32(f, GRAPH_SIGNATURE);
|
||||
|
||||
hashwrite_u8(f, GRAPH_VERSION);
|
||||
hashwrite_u8(f, oid_version());
|
||||
hashwrite_u8(f, oid_version(the_hash_algo));
|
||||
hashwrite_u8(f, get_num_chunks(cf));
|
||||
hashwrite_u8(f, ctx->num_commit_graphs_after - 1);
|
||||
|
||||
|
Reference in New Issue
Block a user