Thread (37 messages) 37 messages, 2 authors, 2024-06-05
STALE745d
Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v1 [diff vs current]
  4. v5 [diff vs current]

[PATCH 5/6] reftable: pick either 'oid' or 'target' for new updates

From: Karthik Nayak <hidden>
Date: 2024-05-14 12:44:21
Subsystem: the rest · Maintainer: Linus Torvalds

From: Karthik Nayak <redacted>

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.

Signed-off-by: Karthik Nayak <redacted>
---
 refs/reftable-backend.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 975061d103..c17e68100d 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -896,8 +896,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;
 
-- 
2.43.GIT
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help