@@ -2271,7 +2271,7 @@ int refs_update_symref_extended(struct ref_store *refs, const char *ref,
2271
2271
REF_NO_DEREF , logmsg , & err ))
2272
2272
goto error_return ;
2273
2273
prepret = ref_transaction_prepare (transaction , & err );
2274
- if (prepret && prepret != TRANSACTION_CREATE_EXISTS )
2274
+ if (prepret && prepret != REF_TRANSACTION_ERROR_CREATE_EXISTS )
2275
2275
goto error_return ;
2276
2276
} else {
2277
2277
if (ref_transaction_update (transaction , ref , NULL , NULL ,
@@ -2289,7 +2289,7 @@ int refs_update_symref_extended(struct ref_store *refs, const char *ref,
2289
2289
}
2290
2290
}
2291
2291
2292
- if (prepret == TRANSACTION_CREATE_EXISTS )
2292
+ if (prepret == REF_TRANSACTION_ERROR_CREATE_EXISTS )
2293
2293
goto cleanup ;
2294
2294
2295
2295
if (ref_transaction_commit (transaction , & err ))
@@ -2425,7 +2425,7 @@ int ref_transaction_prepare(struct ref_transaction *transaction,
2425
2425
2426
2426
string_list_sort (& transaction -> refnames );
2427
2427
if (ref_update_reject_duplicates (& transaction -> refnames , err ))
2428
- return TRANSACTION_GENERIC_ERROR ;
2428
+ return REF_TRANSACTION_ERROR_GENERIC ;
2429
2429
2430
2430
ret = refs -> be -> transaction_prepare (refs , transaction , err );
2431
2431
if (ret )
@@ -2497,19 +2497,19 @@ int ref_transaction_commit(struct ref_transaction *transaction,
2497
2497
return ret ;
2498
2498
}
2499
2499
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 )
2506
2506
{
2507
2507
struct strbuf dirname = STRBUF_INIT ;
2508
2508
struct strbuf referent = STRBUF_INIT ;
2509
2509
struct string_list_item * item ;
2510
2510
struct ref_iterator * iter = NULL ;
2511
2511
struct strset dirnames ;
2512
- int ret = -1 ;
2512
+ int ret = REF_TRANSACTION_ERROR_NAME_CONFLICT ;
2513
2513
2514
2514
/*
2515
2515
* For the sake of comments in this function, suppose that
@@ -2625,12 +2625,13 @@ int refs_verify_refnames_available(struct ref_store *refs,
2625
2625
return ret ;
2626
2626
}
2627
2627
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 )
2634
2635
{
2635
2636
struct string_list_item item = { .string = (char * ) refname };
2636
2637
struct string_list refnames = {
@@ -2818,26 +2819,28 @@ int ref_update_has_null_new_value(struct ref_update *update)
2818
2819
return !update -> new_target && is_null_oid (& update -> new_oid );
2819
2820
}
2820
2821
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 )
2823
2825
{
2824
2826
if (!update -> old_target )
2825
2827
BUG ("called without old_target set" );
2826
2828
2827
2829
if (!strcmp (referent , update -> old_target ))
2828
2830
return 0 ;
2829
2831
2830
- if (!strcmp (referent , "" ))
2832
+ if (!strcmp (referent , "" )) {
2831
2833
strbuf_addf (err , "verifying symref target: '%s': "
2832
2834
"reference is missing but expected %s" ,
2833
2835
ref_update_original_update_refname (update ),
2834
2836
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" ,
2838
2841
ref_update_original_update_refname (update ),
2839
2842
referent , update -> old_target );
2840
- return -1 ;
2843
+ return REF_TRANSACTION_ERROR_INCORRECT_OLD_VALUE ;
2841
2844
}
2842
2845
2843
2846
struct migration_data {
0 commit comments