Skip to content

Commit ee94076

Browse files
committed
Merge branch 'ap/packfile-promisor-object-optim' into next
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
2 parents d30d8ca + 3f5d174 commit ee94076

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ struct object *parse_object_with_flags(struct repository *r,
328328
return &commit->object;
329329
}
330330

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

packfile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,8 @@ static int add_promisor_object(const struct object_id *oid,
23332333
we_parsed_object = 0;
23342334
} else {
23352335
we_parsed_object = 1;
2336-
obj = parse_object(pack->repo, oid);
2336+
obj = parse_object_with_flags(pack->repo, oid,
2337+
PARSE_OBJECT_SKIP_HASH_CHECK);
23372338
}
23382339

23392340
if (!obj)

0 commit comments

Comments
 (0)