diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-12-28 17:36:16 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-12-28 17:36:17 +0900 |
| commit | d480fd08f866ce49219e1dfa641e57b18462908b (patch) | |
| tree | a6e8c442eec8717c38840a4a304686aaab1a2a0f | |
| parent | cb7c6f441e58e5d6ea25c41db0ce3331a11ecf14 (diff) | |
| parent | 3f5d1749e7eb8ab745b348aa138564b809957d3d (diff) | |
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
| -rw-r--r-- | object.c | 4 | ||||
| -rw-r--r-- | packfile.c | 3 |
2 files changed, 4 insertions, 3 deletions
@@ -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; } diff --git a/packfile.c b/packfile.c index c88bd92619..c7438c5b09 100644 --- a/packfile.c +++ b/packfile.c @@ -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) |
