refs: add TRANSACTION_CREATE_EXISTS error

Currently there is only one special error for transaction, for when
there is a naming conflict, all other errors are dumped under a generic
error. Add a new special error case for when the caller requests the
reference to be updated only when it does not yet exist and the
reference actually does exist.

Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Bence Ferdinandy
2024-11-22 13:28:48 +01:00
committed by Junio C Hamano
parent dfe86fa06b
commit ed2f6f8804
3 changed files with 23 additions and 11 deletions

4
refs.h
View File

@ -773,8 +773,10 @@ int ref_transaction_verify(struct ref_transaction *transaction,
/* Naming conflict (for example, the ref names A and A/B conflict). */
#define TRANSACTION_NAME_CONFLICT -1
/* When only creation was requested, but the ref already exists. */
#define TRANSACTION_CREATE_EXISTS -2
/* All other errors. */
#define TRANSACTION_GENERIC_ERROR -2
#define TRANSACTION_GENERIC_ERROR -3
/*
* Perform the preparatory stages of committing `transaction`. Acquire