aboutsummaryrefslogtreecommitdiff
path: root/reftable/stack.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-03-25 11:02:42 +0100
committerJunio C Hamano <gitster@pobox.com>2024-03-25 09:51:11 -0700
commitaf18098c9d2b2e165aca127c35eeb98d157bd542 (patch)
treeb8afafa5d24c559cb4b0c378f59e19abd3da9ddd /reftable/stack.c
parent630942a873ae0f1d067efaaf7b4d1b05cfb3a141 (diff)
downloadgit-af18098c9d2b2e165aca127c35eeb98d157bd542.tar.xz
reftable/error: discern locked/outdated errors
We currently throw two different errors into a similar-but-different error code: - Errors when trying to lock the reftable stack. - Errors when trying to write to the reftable stack which has been modified concurrently. This results in unclear error handling and user-visible error messages. Create a new `REFTABLE_OUTDATED_ERROR` so that those error conditions can be clearly told apart from each other. Adjust users of the old `REFTABLE_LOCK_ERROR` to use the new error code as required. 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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/reftable/stack.c b/reftable/stack.c
index 92d9a7facb..eaa8bb9c99 100644
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@ -529,9 +529,9 @@ int reftable_stack_add(struct reftable_stack *st,
{
int err = stack_try_add(st, write, arg);
if (err < 0) {
- if (err == REFTABLE_LOCK_ERROR) {
+ if (err == REFTABLE_OUTDATED_ERROR) {
/* Ignore error return, we want to propagate
- REFTABLE_LOCK_ERROR.
+ REFTABLE_OUTDATED_ERROR.
*/
reftable_stack_reload(st);
}
@@ -591,7 +591,7 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
if (err < 0)
goto done;
if (err > 0) {
- err = REFTABLE_LOCK_ERROR;
+ err = REFTABLE_OUTDATED_ERROR;
goto done;
}