sequencer: treat REVERT_HEAD as a pseudo ref
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b6d2558c9e
commit
b8825ef233
16
sequencer.c
16
sequencer.c
@ -2317,8 +2317,10 @@ void sequencer_post_commit_cleanup(struct repository *r, int verbose)
|
||||
need_cleanup = 1;
|
||||
}
|
||||
|
||||
if (file_exists(git_path_revert_head(r))) {
|
||||
if (!unlink(git_path_revert_head(r)) && verbose)
|
||||
if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
|
||||
if (!refs_delete_ref(get_main_ref_store(r), "", "REVERT_HEAD",
|
||||
NULL, 0) &&
|
||||
verbose)
|
||||
warning(_("cancelling a revert in progress"));
|
||||
opts.action = REPLAY_REVERT;
|
||||
need_cleanup = 1;
|
||||
@ -2677,7 +2679,7 @@ static int create_seq_dir(struct repository *r)
|
||||
const char *in_progress_error = NULL;
|
||||
const char *in_progress_advice = NULL;
|
||||
unsigned int advise_skip =
|
||||
file_exists(git_path_revert_head(r)) ||
|
||||
refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") ||
|
||||
refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD");
|
||||
|
||||
if (!sequencer_get_last_command(r, &action)) {
|
||||
@ -2778,7 +2780,7 @@ static int rollback_single_pick(struct repository *r)
|
||||
struct object_id head_oid;
|
||||
|
||||
if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
|
||||
!file_exists(git_path_revert_head(r)))
|
||||
!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
|
||||
return error(_("no cherry-pick or revert in progress"));
|
||||
if (read_ref_full("HEAD", 0, &head_oid, NULL))
|
||||
return error(_("cannot resolve HEAD"));
|
||||
@ -2872,7 +2874,7 @@ int sequencer_skip(struct repository *r, struct replay_opts *opts)
|
||||
*/
|
||||
switch (opts->action) {
|
||||
case REPLAY_REVERT:
|
||||
if (!file_exists(git_path_revert_head(r))) {
|
||||
if (!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
|
||||
if (action != REPLAY_REVERT)
|
||||
return error(_("no revert in progress"));
|
||||
if (!rollback_is_safe())
|
||||
@ -4210,7 +4212,7 @@ static int continue_single_pick(struct repository *r)
|
||||
const char *argv[] = { "commit", NULL };
|
||||
|
||||
if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
|
||||
!file_exists(git_path_revert_head(r)))
|
||||
!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
|
||||
return error(_("no cherry-pick or revert in progress"));
|
||||
return run_command_v_opt(argv, RUN_GIT_CMD);
|
||||
}
|
||||
@ -4390,7 +4392,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
|
||||
/* Verify that the conflict has been resolved */
|
||||
if (refs_ref_exists(get_main_ref_store(r),
|
||||
"CHERRY_PICK_HEAD") ||
|
||||
file_exists(git_path_revert_head(r))) {
|
||||
refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) {
|
||||
res = continue_single_pick(r);
|
||||
if (res)
|
||||
goto release_todo_list;
|
||||
|
||||
Reference in New Issue
Block a user