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>
This commit is contained in:
committed by
Junio C Hamano
parent
6fb1d819b7
commit
178c588500
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user