]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sequencer.h
sequencer: make the todo_list structure public
[thirdparty/git.git] / sequencer.h
index 9d83f0f3e90313be990439972845e9d4f2bc1804..c6360bac66b033ef2bbc76d1dc5c720442972ff9 100644 (file)
@@ -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,