@@ -2271,7 +2271,7 @@ int refs_update_symref_extended(struct ref_store *refs, const char *ref,
22712271 REF_NO_DEREF , logmsg , & err ))
22722272 goto error_return ;
22732273 prepret = ref_transaction_prepare (transaction , & err );
2274- if (prepret && prepret != TRANSACTION_CREATE_EXISTS )
2274+ if (prepret && prepret != REF_TRANSACTION_ERROR_CREATE_EXISTS )
22752275 goto error_return ;
22762276 } else {
22772277 if (ref_transaction_update (transaction , ref , NULL , NULL ,
@@ -2289,7 +2289,7 @@ int refs_update_symref_extended(struct ref_store *refs, const char *ref,
22892289 }
22902290 }
22912291
2292- if (prepret == TRANSACTION_CREATE_EXISTS )
2292+ if (prepret == REF_TRANSACTION_ERROR_CREATE_EXISTS )
22932293 goto cleanup ;
22942294
22952295 if (ref_transaction_commit (transaction , & err ))
@@ -2425,7 +2425,7 @@ int ref_transaction_prepare(struct ref_transaction *transaction,
24252425
24262426 string_list_sort (& transaction -> refnames );
24272427 if (ref_update_reject_duplicates (& transaction -> refnames , err ))
2428- return TRANSACTION_GENERIC_ERROR ;
2428+ return REF_TRANSACTION_ERROR_GENERIC ;
24292429
24302430 ret = refs -> be -> transaction_prepare (refs , transaction , err );
24312431 if (ret )
@@ -2497,19 +2497,19 @@ int ref_transaction_commit(struct ref_transaction *transaction,
24972497 return ret ;
24982498}
24992499
2500- int refs_verify_refnames_available (struct ref_store * refs ,
2501- const struct string_list * refnames ,
2502- const struct string_list * extras ,
2503- const struct string_list * skip ,
2504- unsigned int initial_transaction ,
2505- struct strbuf * err )
2500+ enum ref_transaction_error refs_verify_refnames_available (struct ref_store * refs ,
2501+ const struct string_list * refnames ,
2502+ const struct string_list * extras ,
2503+ const struct string_list * skip ,
2504+ unsigned int initial_transaction ,
2505+ struct strbuf * err )
25062506{
25072507 struct strbuf dirname = STRBUF_INIT ;
25082508 struct strbuf referent = STRBUF_INIT ;
25092509 struct string_list_item * item ;
25102510 struct ref_iterator * iter = NULL ;
25112511 struct strset dirnames ;
2512- int ret = -1 ;
2512+ int ret = REF_TRANSACTION_ERROR_NAME_CONFLICT ;
25132513
25142514 /*
25152515 * For the sake of comments in this function, suppose that
@@ -2625,12 +2625,13 @@ int refs_verify_refnames_available(struct ref_store *refs,
26252625 return ret ;
26262626}
26272627
2628- int refs_verify_refname_available (struct ref_store * refs ,
2629- const char * refname ,
2630- const struct string_list * extras ,
2631- const struct string_list * skip ,
2632- unsigned int initial_transaction ,
2633- struct strbuf * err )
2628+ enum ref_transaction_error refs_verify_refname_available (
2629+ struct ref_store * refs ,
2630+ const char * refname ,
2631+ const struct string_list * extras ,
2632+ const struct string_list * skip ,
2633+ unsigned int initial_transaction ,
2634+ struct strbuf * err )
26342635{
26352636 struct string_list_item item = { .string = (char * ) refname };
26362637 struct string_list refnames = {
@@ -2818,26 +2819,28 @@ int ref_update_has_null_new_value(struct ref_update *update)
28182819 return !update -> new_target && is_null_oid (& update -> new_oid );
28192820}
28202821
2821- int ref_update_check_old_target (const char * referent , struct ref_update * update ,
2822- struct strbuf * err )
2822+ enum ref_transaction_error ref_update_check_old_target (const char * referent ,
2823+ struct ref_update * update ,
2824+ struct strbuf * err )
28232825{
28242826 if (!update -> old_target )
28252827 BUG ("called without old_target set" );
28262828
28272829 if (!strcmp (referent , update -> old_target ))
28282830 return 0 ;
28292831
2830- if (!strcmp (referent , "" ))
2832+ if (!strcmp (referent , "" )) {
28312833 strbuf_addf (err , "verifying symref target: '%s': "
28322834 "reference is missing but expected %s" ,
28332835 ref_update_original_update_refname (update ),
28342836 update -> old_target );
2835- else
2836- strbuf_addf (err , "verifying symref target: '%s': "
2837- "is at %s but expected %s" ,
2837+ return REF_TRANSACTION_ERROR_NONEXISTENT_REF ;
2838+ }
2839+
2840+ strbuf_addf (err , "verifying symref target: '%s': is at %s but expected %s" ,
28382841 ref_update_original_update_refname (update ),
28392842 referent , update -> old_target );
2840- return -1 ;
2843+ return REF_TRANSACTION_ERROR_INCORRECT_OLD_VALUE ;
28412844}
28422845
28432846struct migration_data {
0 commit comments