aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-19 10:55:40 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-19 10:55:42 -0800
commitee270059057ca87fe9d9c50dbb5fa1399ed98cb1 (patch)
tree608fde265c9f400544d4277d9a9668da70fc2a44
parent7ccfc262d7850f2eddd860b31b9f69a152687702 (diff)
parent7048e74609fbef2c91bfa3a80e3a9c4fc0ac04c9 (diff)
downloadgit-ee270059057ca87fe9d9c50dbb5fa1399ed98cb1.tar.gz
Merge branch 'ps/ref-peeled-tags-fixes'
Another fix-up to "peeled-tags" topic. * ps/ref-peeled-tags-fixes: object: fix performance regression when peeling tags
-rw-r--r--object.c4
-rw-r--r--object.h12
-rw-r--r--ref-filter.c2
-rw-r--r--refs/packed-backend.c2
-rw-r--r--refs/reftable-backend.c2
5 files changed, 11 insertions, 11 deletions
diff --git a/object.c b/object.c
index e72b0ed436..b08fc7a163 100644
--- a/object.c
+++ b/object.c
@@ -214,7 +214,7 @@ enum peel_status peel_object(struct repository *r,
{
struct object *o = lookup_unknown_object(r, name);
- if (o->type == OBJ_NONE || flags & PEEL_OBJECT_VERIFY_OBJECT_TYPE) {
+ if (o->type == OBJ_NONE) {
int type = odb_read_object_info(r->objects, name, NULL);
if (type < 0 || !object_as_type(o, type, 0))
return PEEL_INVALID;
@@ -228,7 +228,7 @@ enum peel_status peel_object(struct repository *r,
if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged) {
o = ((struct tag *)o)->tagged;
- if (flags & PEEL_OBJECT_VERIFY_OBJECT_TYPE) {
+ if (flags & PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE) {
int type = odb_read_object_info(r->objects, &o->oid, NULL);
if (type < 0 || !object_as_type(o, type, 0))
return PEEL_INVALID;
diff --git a/object.h b/object.h
index fd15eecce8..6362130597 100644
--- a/object.h
+++ b/object.h
@@ -290,13 +290,13 @@ enum peel_status {
enum peel_object_flags {
/*
- * Always verify the object type, even in the case where the looked-up
- * object already has an object type. This can be useful when the
- * stored object type may be invalid. One such case is when looking up
- * objects via tags, where we blindly trust the object type declared by
- * the tag.
+ * Always verify the object type of the tagged object, even in the case
+ * where the looked-up object already has an object type. This can be
+ * useful when the tagged object type may be invalid. One such case is
+ * when looking up objects via tags, where we blindly trust the object
+ * type declared by the tag.
*/
- PEEL_OBJECT_VERIFY_OBJECT_TYPE = (1 << 0),
+ PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE = (1 << 0),
};
/*
diff --git a/ref-filter.c b/ref-filter.c
index d8667c569a..d7454269e8 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -2654,7 +2654,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
if (!is_null_oid(&ref->peeled_oid)) {
oidcpy(&oi_deref.oid, &ref->peeled_oid);
} else if (!peel_object(the_repository, &oi.oid, &oi_deref.oid,
- PEEL_OBJECT_VERIFY_OBJECT_TYPE)) {
+ PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE)) {
/* We managed to peel the object ourselves. */
} else {
die("bad tag");
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 10062fd8b6..62676a03c9 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1528,7 +1528,7 @@ static enum ref_transaction_error write_with_updates(struct packed_ref_store *re
} else {
struct object_id peeled;
int peel_error = peel_object(refs->base.repo, &update->new_oid,
- &peeled, PEEL_OBJECT_VERIFY_OBJECT_TYPE);
+ &peeled, PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE);
if (write_packed_entry(out, update->refname,
&update->new_oid,
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 38fc5ae510..19ae8fae04 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -1633,7 +1633,7 @@ static int write_transaction_table(struct reftable_writer *writer, void *cb_data
ref.update_index = ts;
peel_error = peel_object(arg->refs->base.repo, &u->new_oid, &peeled,
- PEEL_OBJECT_VERIFY_OBJECT_TYPE);
+ PEEL_OBJECT_VERIFY_TAGGED_OBJECT_TYPE);
if (!peel_error) {
ref.value_type = REFTABLE_REF_VAL2;
memcpy(ref.value.val2.target_value, peeled.hash, GIT_MAX_RAWSZ);