From: Karthik Nayak Date: Fri, 7 Jun 2024 13:33:03 +0000 (+0200) Subject: reftable: pick either 'oid' or 'target' for new updates X-Git-Tag: v2.46.0-rc0~44^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f1dcdd6deb6bdd57e3e8dad5aa7a3fcc1526b9ec;p=thirdparty%2Fgit.git reftable: pick either 'oid' or 'target' for new updates When creating a reference transaction update, we can provide the old/new oid/target for the update. We have checks in place to ensure that for each old/new, either oid or target is set and not both. In the reftable backend, when dealing with updates without the `REF_NO_DEREF` flag, we don't selectively propagate data as needed. Since there are no active users of the path, this is not caught. As we want to introduce the 'symref-update' command in the upcoming commit, which would use this flow, correct it. Helped-by: Patrick Steinhardt Signed-off-by: Karthik Nayak Signed-off-by: Junio C Hamano --- diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 16f4ced7b6..06dd5c8f31 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -898,8 +898,9 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store, */ new_update = ref_transaction_add_update( transaction, referent.buf, new_flags, - &u->new_oid, &u->old_oid, u->new_target, - u->old_target, u->msg); + u->new_target ? NULL : &u->new_oid, + u->old_target ? NULL : &u->old_oid, + u->new_target, u->old_target, u->msg); new_update->parent_update = u;