mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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
This commit is contained in:
4
object.c
4
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;
|
||||
|
||||
12
object.h
12
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),
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user