diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-08-12 11:54:19 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-08-12 07:40:59 -0700 |
| commit | 178c5885007b83dd10cac1e09b72ef8d9fe2ac29 (patch) | |
| tree | 9d00bd40837cd9c1d026140d419f673ac8c9c2e3 /reftable/stack.c | |
| parent | reftable/stack: fix compiler warning due to missing braces (diff) | |
| download | git-178c5885007b83dd10cac1e09b72ef8d9fe2ac29.tar.gz git-178c5885007b83dd10cac1e09b72ef8d9fe2ac29.zip | |
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/stack.c')
| -rw-r--r-- | reftable/stack.c | 8 |
1 files changed, 4 insertions, 4 deletions
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 |
