@@ -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,18 +2497,18 @@ 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  ref_iterator  * iter  =  NULL ;
25102510	struct  strset  dirnames ;
2511- 	int  ret  =  -1 ;
2511+ 	int  ret  =  REF_TRANSACTION_ERROR_NAME_CONFLICT ;
25122512
25132513	/* 
25142514	 * For the sake of comments in this function, suppose that 
@@ -2624,12 +2624,13 @@ int refs_verify_refnames_available(struct ref_store *refs,
26242624	return  ret ;
26252625}
26262626
2627- int  refs_verify_refname_available (struct  ref_store  * refs ,
2628- 				  const  char  * refname ,
2629- 				  const  struct  string_list  * extras ,
2630- 				  const  struct  string_list  * skip ,
2631- 				  unsigned int   initial_transaction ,
2632- 				  struct  strbuf  * err )
2627+ enum  ref_transaction_error  refs_verify_refname_available (
2628+ 	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 )
26332634{
26342635	struct  string_list_item  item  =  { .string  =  (char  * ) refname  };
26352636	struct  string_list  refnames  =  {
@@ -2817,26 +2818,28 @@ int ref_update_has_null_new_value(struct ref_update *update)
28172818	return  !update -> new_target  &&  is_null_oid (& update -> new_oid );
28182819}
28192820
2820- int  ref_update_check_old_target (const  char  * referent , struct  ref_update  * update ,
2821- 				struct  strbuf  * err )
2821+ enum  ref_transaction_error  ref_update_check_old_target (const  char  * referent ,
2822+ 						       struct  ref_update  * update ,
2823+ 						       struct  strbuf  * err )
28222824{
28232825	if  (!update -> old_target )
28242826		BUG ("called without old_target set" );
28252827
28262828	if  (!strcmp (referent , update -> old_target ))
28272829		return  0 ;
28282830
2829- 	if  (!strcmp (referent , "" ))
2831+ 	if  (!strcmp (referent , "" )) { 
28302832		strbuf_addf (err , "verifying symref target: '%s': " 
28312833			    "reference is missing but expected %s" ,
28322834			    ref_update_original_update_refname (update ),
28332835			    update -> old_target );
2834- 	else 
2835- 		strbuf_addf (err , "verifying symref target: '%s': " 
2836- 			    "is at %s but expected %s" ,
2836+ 		return  REF_TRANSACTION_ERROR_NONEXISTENT_REF ;
2837+ 	}
2838+ 
2839+ 	strbuf_addf (err , "verifying symref target: '%s': is at %s but expected %s" ,
28372840			    ref_update_original_update_refname (update ),
28382841			    referent , update -> old_target );
2839- 	return  -1 ;
2842+ 	return  REF_TRANSACTION_ERROR_INCORRECT_OLD_VALUE ;
28402843}
28412844
28422845struct  migration_data  {
0 commit comments