diff options
| author | Karthik Nayak <karthik.188@gmail.com> | 2025-04-08 10:51:09 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-04-08 07:57:20 -0700 |
| commit | 76e760b99923cb9afb52ef08607f736ff3eeaad7 (patch) | |
| tree | 4af32ed614279fdf4d28129c99d5311c893b3cef /refs/refs-internal.h | |
| parent | refs/reftable: extract code from the transaction preparation (diff) | |
| download | git-76e760b99923cb9afb52ef08607f736ff3eeaad7.tar.gz git-76e760b99923cb9afb52ef08607f736ff3eeaad7.zip | |
refs: introduce enum-based transaction error types
Replace preprocessor-defined transaction errors with a strongly-typed
enum `ref_transaction_error`. This change:
- Improves type safety and function signature clarity.
- Makes error handling more explicit and discoverable.
- Maintains existing error cases, while adding new error cases for
common scenarios.
This refactoring paves the way for more comprehensive error handling
which we will utilize in the upcoming commits to add batch reference
update support.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/refs-internal.h')
| -rw-r--r-- | refs/refs-internal.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 6d3770d0cc..3f1d19abd9 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -770,8 +770,9 @@ int ref_update_has_null_new_value(struct ref_update *update); * If everything is OK, return 0; otherwise, write an error message to * err and return -1. */ -int ref_update_check_old_target(const char *referent, struct ref_update *update, - struct strbuf *err); +enum ref_transaction_error ref_update_check_old_target(const char *referent, + struct ref_update *update, + struct strbuf *err); /* * Check if the ref must exist, this means that the old_oid or |
