@@ -2317,8 +2317,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
2317
2317
need_cleanup = 1 ;
2318
2318
}
2319
2319
2320
- if (file_exists (git_path_revert_head (r ))) {
2321
- if (!unlink (git_path_revert_head (r )) && verbose )
2320
+ if (refs_ref_exists (get_main_ref_store (r ), "REVERT_HEAD" )) {
2321
+ if (!refs_delete_ref (get_main_ref_store (r ), "" , "REVERT_HEAD" ,
2322
+ NULL , 0 ) &&
2323
+ verbose )
2322
2324
warning (_ ("cancelling a revert in progress" ));
2323
2325
opts .action = REPLAY_REVERT ;
2324
2326
need_cleanup = 1 ;
@@ -2677,7 +2679,7 @@ static int create_seq_dir(struct repository *r)
2677
2679
const char * in_progress_error = NULL ;
2678
2680
const char * in_progress_advice = NULL ;
2679
2681
unsigned int advise_skip =
2680
- file_exists ( git_path_revert_head (r )) ||
2682
+ refs_ref_exists ( get_main_ref_store (r ), "REVERT_HEAD" ) ||
2681
2683
refs_ref_exists (get_main_ref_store (r ), "CHERRY_PICK_HEAD" );
2682
2684
2683
2685
if (!sequencer_get_last_command (r , & action )) {
@@ -2778,7 +2780,7 @@ static int rollback_single_pick(struct repository *r)
2778
2780
struct object_id head_oid ;
2779
2781
2780
2782
if (!refs_ref_exists (get_main_ref_store (r ), "CHERRY_PICK_HEAD" ) &&
2781
- !file_exists ( git_path_revert_head (r )))
2783
+ !refs_ref_exists ( get_main_ref_store (r ), "REVERT_HEAD" ))
2782
2784
return error (_ ("no cherry-pick or revert in progress" ));
2783
2785
if (read_ref_full ("HEAD" , 0 , & head_oid , NULL ))
2784
2786
return error (_ ("cannot resolve HEAD" ));
@@ -2872,7 +2874,7 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
2872
2874
*/
2873
2875
switch (opts -> action ) {
2874
2876
case REPLAY_REVERT :
2875
- if (!file_exists ( git_path_revert_head (r ))) {
2877
+ if (!refs_ref_exists ( get_main_ref_store (r ), "REVERT_HEAD" )) {
2876
2878
if (action != REPLAY_REVERT )
2877
2879
return error (_ ("no revert in progress" ));
2878
2880
if (!rollback_is_safe ())
@@ -4210,7 +4212,7 @@ static int continue_single_pick(struct repository *r)
4210
4212
const char * argv [] = { "commit" , NULL };
4211
4213
4212
4214
if (!refs_ref_exists (get_main_ref_store (r ), "CHERRY_PICK_HEAD" ) &&
4213
- !file_exists ( git_path_revert_head (r )))
4215
+ !refs_ref_exists ( get_main_ref_store (r ), "REVERT_HEAD" ))
4214
4216
return error (_ ("no cherry-pick or revert in progress" ));
4215
4217
return run_command_v_opt (argv , RUN_GIT_CMD );
4216
4218
}
@@ -4390,7 +4392,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
4390
4392
/* Verify that the conflict has been resolved */
4391
4393
if (refs_ref_exists (get_main_ref_store (r ),
4392
4394
"CHERRY_PICK_HEAD" ) ||
4393
- file_exists ( git_path_revert_head (r ))) {
4395
+ refs_ref_exists ( get_main_ref_store (r ), "REVERT_HEAD" )) {
4394
4396
res = continue_single_pick (r );
4395
4397
if (res )
4396
4398
goto release_todo_list ;
0 commit comments