From 178c5885007b83dd10cac1e09b72ef8d9fe2ac29 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 12 Aug 2025 11:54:19 +0200 Subject: reftable/stack: allow passing flags to `reftable_stack_add()` The `reftable_stack_add()` function is a simple wrapper to lock the stack, add records to it via a callback and then commit the result. One problem with it though is that it doesn't accept any flags for creating the addition. This makes it impossible to automatically reload the stack in case it was modified before we managed to lock the stack. Add a `flags` field to plug this gap and pass it through accordingly. For now this new flag won't be used by us, but it will be used by libgit2. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- reftable/stack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'reftable/stack.c') diff --git a/reftable/stack.c b/reftable/stack.c index 9db90cf4ed..1ce4d90cb8 100644 --- a/reftable/stack.c +++ b/reftable/stack.c @@ -736,12 +736,12 @@ done: static int stack_try_add(struct reftable_stack *st, int (*write_table)(struct reftable_writer *wr, void *arg), - void *arg) + void *arg, unsigned flags) { struct reftable_addition add; int err; - err = reftable_stack_init_addition(&add, st, 0); + err = reftable_stack_init_addition(&add, st, flags); if (err < 0) goto done; @@ -757,9 +757,9 @@ done: int reftable_stack_add(struct reftable_stack *st, int (*write)(struct reftable_writer *wr, void *arg), - void *arg) + void *arg, unsigned flags) { - int err = stack_try_add(st, write, arg); + int err = stack_try_add(st, write, arg, flags); if (err < 0) { if (err == REFTABLE_OUTDATED_ERROR) { /* Ignore error return, we want to propagate -- cgit v1.3