Treat CHERRY_PICK_HEAD as a pseudo ref

Check for existence and delete CHERRY_PICK_HEAD through pseudo ref functions.
This will help cherry-pick work with alternate ref storage backends.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Han-Wen Nienhuys
2020-06-16 19:20:31 +00:00
committed by Junio C Hamano
parent c69b75b7d9
commit 7bff03216e
6 changed files with 52 additions and 38 deletions

View File

@ -847,21 +847,25 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS &&
!merge_contains_scissors)
wt_status_add_cut_line(s->fp);
status_printf_ln(s, GIT_COLOR_NORMAL,
whence == FROM_MERGE
? _("\n"
"It looks like you may be committing a merge.\n"
"If this is not correct, please remove the file\n"
" %s\n"
"and try again.\n")
: _("\n"
"It looks like you may be committing a cherry-pick.\n"
"If this is not correct, please remove the file\n"
" %s\n"
"and try again.\n"),
whence == FROM_MERGE ?
git_path_merge_head(the_repository) :
git_path_cherry_pick_head(the_repository));
if (whence == FROM_MERGE)
status_printf_ln(
s, GIT_COLOR_NORMAL,
_("\n"
"It looks like you may be committing a merge.\n"
"If this is not correct, please remove the file\n"
" %s\n"
"and try again.\n"),
git_path_merge_head(the_repository));
else
status_printf_ln(
s, GIT_COLOR_NORMAL,
_("\n"
"It looks like you may be committing a cherry-pick.\n"
"If this is not correct, please run\n"
" git cherry-pick --abort\n"
"and try again.\n"));
}
fprintf(s->fp, "\n");