Skip to content

Commit 2a7efd5

Browse files
committed
Merge branch 'ps/ref-peeled-tags-fixes' into jch
* ps/ref-peeled-tags-fixes: object: fix performance regression when peeling tags
2 parents 6b82720 + 7048e74 commit 2a7efd5

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ enum peel_status peel_object(struct repository *r,
214214
{
215215
struct object *o = lookup_unknown_object(r, name);
216216

217-
if (o->type == OBJ_NONE || flags & PEEL_OBJECT_VERIFY_OBJECT_TYPE) {
217+
if (o->type == OBJ_NONE) {
218218
int type = odb_read_object_info(r->objects, name, NULL);
219219
if (type < 0 || !object_as_type(o, type, 0))
220220
return PEEL_INVALID;
@@ -228,7 +228,7 @@ enum peel_status peel_object(struct repository *r,
228228
if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged) {
229229
o = ((struct tag *)o)->tagged;
230230

231-
if (flags & PEEL_OBJECT_VERIFY_OBJECT_TYPE) {
231+
if (flags & PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE) {
232232
int type = odb_read_object_info(r->objects, &o->oid, NULL);
233233
if (type < 0 || !object_as_type(o, type, 0))
234234
return PEEL_INVALID;

object.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,13 @@ enum peel_status {
289289

290290
enum peel_object_flags {
291291
/*
292-
* Always verify the object type, even in the case where the looked-up
293-
* object already has an object type. This can be useful when the
294-
* stored object type may be invalid. One such case is when looking up
295-
* objects via tags, where we blindly trust the object type declared by
296-
* the tag.
292+
* Always verify the object type of the tagged object, even in the case
293+
* where the looked-up object already has an object type. This can be
294+
* useful when the tagged object type may be invalid. One such case is
295+
* when looking up objects via tags, where we blindly trust the object
296+
* type declared by the tag.
297297
*/
298-
PEEL_OBJECT_VERIFY_OBJECT_TYPE = (1 << 0),
298+
PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE = (1 << 0),
299299
};
300300

301301
/*

ref-filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
26542654
if (!is_null_oid(&ref->peeled_oid)) {
26552655
oidcpy(&oi_deref.oid, &ref->peeled_oid);
26562656
} else if (!peel_object(the_repository, &oi.oid, &oi_deref.oid,
2657-
PEEL_OBJECT_VERIFY_OBJECT_TYPE)) {
2657+
PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE)) {
26582658
/* We managed to peel the object ourselves. */
26592659
} else {
26602660
die("bad tag");

refs/packed-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ static enum ref_transaction_error write_with_updates(struct packed_ref_store *re
15281528
} else {
15291529
struct object_id peeled;
15301530
int peel_error = peel_object(refs->base.repo, &update->new_oid,
1531-
&peeled, PEEL_OBJECT_VERIFY_OBJECT_TYPE);
1531+
&peeled, PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE);
15321532

15331533
if (write_packed_entry(out, update->refname,
15341534
&update->new_oid,

refs/reftable-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ static int write_transaction_table(struct reftable_writer *writer, void *cb_data
16331633
ref.update_index = ts;
16341634

16351635
peel_error = peel_object(arg->refs->base.repo, &u->new_oid, &peeled,
1636-
PEEL_OBJECT_VERIFY_OBJECT_TYPE);
1636+
PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE);
16371637
if (!peel_error) {
16381638
ref.value_type = REFTABLE_REF_VAL2;
16391639
memcpy(ref.value.val2.target_value, peeled.hash, GIT_MAX_RAWSZ);

0 commit comments

Comments
 (0)