summaryrefslogtreecommitdiff
path: root/sequencer.h
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2018-12-29 16:03:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-08 21:22:09 (GMT)
commit5d94d54564fb0dea1f3caf2f1dacb7701f4be25c (patch)
treef37cc7f7770e7ff7640079cd0cf7482323d50f48 /sequencer.h
parent2b71595d47a75031346d7bc0125da39a9bb10126 (diff)
downloadgit-5d94d54564fb0dea1f3caf2f1dacb7701f4be25c.zip
git-5d94d54564fb0dea1f3caf2f1dacb7701f4be25c.tar.gz
git-5d94d54564fb0dea1f3caf2f1dacb7701f4be25c.tar.bz2
sequencer: make the todo_list structure public
This makes the structures todo_list and todo_item, and the functions todo_list_release() and parse_insn_buffer(), accessible outside of sequencer.c. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.h')
-rw-r--r--sequencer.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/sequencer.h b/sequencer.h
index 9d83f0f..c6360ba 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -73,6 +73,56 @@ enum missing_commit_check_level {
int write_message(const void *buf, size_t len, const char *filename,
int append_eol);
+/*
+ * Note that ordering matters in this enum. Not only must it match the mapping
+ * of todo_command_info (in sequencer.c), it is also divided into several
+ * sections that matter. When adding new commands, make sure you add it in the
+ * right section.
+ */
+enum todo_command {
+ /* commands that handle commits */
+ TODO_PICK = 0,
+ TODO_REVERT,
+ TODO_EDIT,
+ TODO_REWORD,
+ TODO_FIXUP,
+ TODO_SQUASH,
+ /* commands that do something else than handling a single commit */
+ TODO_EXEC,
+ TODO_BREAK,
+ TODO_LABEL,
+ TODO_RESET,
+ TODO_MERGE,
+ /* commands that do nothing but are counted for reporting progress */
+ TODO_NOOP,
+ TODO_DROP,
+ /* comments (not counted for reporting progress) */
+ TODO_COMMENT
+};
+
+struct todo_item {
+ enum todo_command command;
+ struct commit *commit;
+ unsigned int flags;
+ const char *arg;
+ int arg_len;
+ size_t offset_in_buf;
+};
+
+struct todo_list {
+ struct strbuf buf;
+ struct todo_item *items;
+ int nr, alloc, current;
+ int done_nr, total_nr;
+ struct stat_data stat;
+};
+
+#define TODO_LIST_INIT { STRBUF_INIT }
+
+int todo_list_parse_insn_buffer(struct repository *r, char *buf,
+ struct todo_list *todo_list);
+void todo_list_release(struct todo_list *todo_list);
+
/* Call this to setup defaults before parsing command line options */
void sequencer_init_config(struct replay_opts *opts);
int sequencer_pick_revisions(struct repository *repo,