Merge branch 'ap/packfile-promisor-object-optim'

The code path that enumerates promisor objects have been optimized
to skip pointlessly parsing blob objects.

* ap/packfile-promisor-object-optim:
  packfile: skip hash checks in add_promisor_object()
  object: apply skip_hash and discard_tree optimizations to unknown blobs too
main
Junio C Hamano 2025-12-28 17:36:16 +09:00
commit d480fd08f8
2 changed files with 4 additions and 3 deletions

View File

@ -328,7 +328,7 @@ struct object *parse_object_with_flags(struct repository *r,
return &commit->object;
}

if ((!obj || obj->type == OBJ_BLOB) &&
if ((!obj || obj->type == OBJ_NONE || obj->type == OBJ_BLOB) &&
odb_read_object_info(r->objects, oid, NULL) == OBJ_BLOB) {
if (!skip_hash && stream_object_signature(r, repl) < 0) {
error(_("hash mismatch %s"), oid_to_hex(oid));
@ -344,7 +344,7 @@ struct object *parse_object_with_flags(struct repository *r,
* have the on-disk object with the correct type.
*/
if (skip_hash && discard_tree &&
(!obj || obj->type == OBJ_TREE) &&
(!obj || obj->type == OBJ_NONE || obj->type == OBJ_TREE) &&
odb_read_object_info(r->objects, oid, NULL) == OBJ_TREE) {
return &lookup_tree(r, oid)->object;
}

View File

@ -2333,7 +2333,8 @@ static int add_promisor_object(const struct object_id *oid,
we_parsed_object = 0;
} else {
we_parsed_object = 1;
obj = parse_object(pack->repo, oid);
obj = parse_object_with_flags(pack->repo, oid,
PARSE_OBJECT_SKIP_HASH_CHECK);
}

if (!obj)