summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2019-12-06 16:06:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-06 17:32:02 (GMT)
commit901ba7b1efe8ba9464aac528ecd46e8dd4f01003 (patch)
tree546da93b1d4d3f4360d84064836cb62396a690ce /sequencer.c
parent8d57f7574993deb906461d4267373e1c9c733053 (diff)
downloadgit-901ba7b1efe8ba9464aac528ecd46e8dd4f01003.zip
git-901ba7b1efe8ba9464aac528ecd46e8dd4f01003.tar.gz
git-901ba7b1efe8ba9464aac528ecd46e8dd4f01003.tar.bz2
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>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index d668568..dcc2063 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -40,7 +40,7 @@ static const char cherry_picked_prefix[] = "(cherry picked from commit ";
GIT_PATH_FUNC(git_path_commit_editmsg, "COMMIT_EDITMSG")
-GIT_PATH_FUNC(git_path_seq_dir, "sequencer")
+static GIT_PATH_FUNC(git_path_seq_dir, "sequencer")
static GIT_PATH_FUNC(git_path_todo_file, "sequencer/todo")
static GIT_PATH_FUNC(git_path_opts_file, "sequencer/opts")
@@ -5312,3 +5312,14 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
return 0;
}
+
+int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
+{
+ if (file_exists(git_path_cherry_pick_head(r))) {
+ *whence = file_exists(git_path_seq_dir()) ?
+ FROM_CHERRY_PICK_MULTI : FROM_CHERRY_PICK_SINGLE;
+ return 1;
+ }
+
+ return 0;
+}