commit: encapsulate determine_whence() for sequencer

Working out which command wants to create a commit requires detailed
knowledge of the sequencer internals and that knowledge is going to
increase in subsequent commits. With that in mind lets encapsulate that
knowledge in sequencer.c rather than spreading it into builtin/commit.c.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Phillip Wood
2019-12-06 16:06:11 +00:00
committed by Junio C Hamano
parent 8d57f75749
commit 901ba7b1ef
3 changed files with 15 additions and 6 deletions

View File

@@ -178,10 +178,7 @@ static void determine_whence(struct wt_status *s)
{
if (file_exists(git_path_merge_head(the_repository)))
whence = FROM_MERGE;
else if (file_exists(git_path_cherry_pick_head(the_repository)))
whence = file_exists(git_path_seq_dir()) ?
FROM_CHERRY_PICK_MULTI : FROM_CHERRY_PICK_SINGLE;
else
else if (!sequencer_determine_whence(the_repository, &whence))
whence = FROM_COMMIT;
if (s)
s->whence = whence;