| 1 | #ifndef SEQUENCER_H |
| 2 | #define SEQUENCER_H |
| 3 | |
| 4 | const char *git_path_commit_editmsg(void); |
| 5 | const char *git_path_seq_dir(void); |
| 6 | |
| 7 | #define APPEND_SIGNOFF_DEDUP (1u << 0) |
| 8 | |
| 9 | enum replay_action { |
| 10 | REPLAY_REVERT, |
| 11 | REPLAY_PICK, |
| 12 | REPLAY_INTERACTIVE_REBASE |
| 13 | }; |
| 14 | |
| 15 | enum commit_msg_cleanup_mode { |
| 16 | COMMIT_MSG_CLEANUP_SPACE, |
| 17 | COMMIT_MSG_CLEANUP_NONE, |
| 18 | COMMIT_MSG_CLEANUP_SCISSORS, |
| 19 | COMMIT_MSG_CLEANUP_ALL |
| 20 | }; |
| 21 | |
| 22 | struct replay_opts { |
| 23 | enum replay_action action; |
| 24 | |
| 25 | /* Boolean options */ |
| 26 | int edit; |
| 27 | int record_origin; |
| 28 | int no_commit; |
| 29 | int signoff; |
| 30 | int allow_ff; |
| 31 | int allow_rerere_auto; |
| 32 | int allow_empty; |
| 33 | int allow_empty_message; |
| 34 | int keep_redundant_commits; |
| 35 | int verbose; |
| 36 | |
| 37 | int mainline; |
| 38 | |
| 39 | char *gpg_sign; |
| 40 | enum commit_msg_cleanup_mode default_msg_cleanup; |
| 41 | |
| 42 | /* Merge strategy */ |
| 43 | char *strategy; |
| 44 | char **xopts; |
| 45 | size_t xopts_nr, xopts_alloc; |
| 46 | |
| 47 | /* Only used by REPLAY_NONE */ |
| 48 | struct rev_info *revs; |
| 49 | }; |
| 50 | #define REPLAY_OPTS_INIT { -1 } |
| 51 | |
| 52 | /* Call this to setup defaults before parsing command line options */ |
| 53 | void sequencer_init_config(struct replay_opts *opts); |
| 54 | int sequencer_pick_revisions(struct replay_opts *opts); |
| 55 | int sequencer_continue(struct replay_opts *opts); |
| 56 | int sequencer_rollback(struct replay_opts *opts); |
| 57 | int sequencer_remove_state(struct replay_opts *opts); |
| 58 | |
| 59 | #define TODO_LIST_KEEP_EMPTY (1U << 0) |
| 60 | #define TODO_LIST_SHORTEN_IDS (1U << 1) |
| 61 | #define TODO_LIST_ABBREVIATE_CMDS (1U << 2) |
| 62 | int sequencer_make_script(FILE *out, int argc, const char **argv, |
| 63 | unsigned flags); |
| 64 | |
| 65 | int sequencer_add_exec_commands(const char *command); |
| 66 | int transform_todos(unsigned flags); |
| 67 | int check_todo_list(void); |
| 68 | int skip_unnecessary_picks(void); |
| 69 | int rearrange_squash(void); |
| 70 | |
| 71 | extern const char sign_off_header[]; |
| 72 | |
| 73 | void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag); |
| 74 | void append_conflicts_hint(struct strbuf *msgbuf); |
| 75 | int message_is_empty(const struct strbuf *sb, |
| 76 | enum commit_msg_cleanup_mode cleanup_mode); |
| 77 | int template_untouched(const struct strbuf *sb, const char *template_file, |
| 78 | enum commit_msg_cleanup_mode cleanup_mode); |
| 79 | int update_head_with_reflog(const struct commit *old_head, |
| 80 | const struct object_id *new_head, |
| 81 | const char *action, const struct strbuf *msg, |
| 82 | struct strbuf *err); |
| 83 | void commit_post_rewrite(const struct commit *current_head, |
| 84 | const struct object_id *new_head); |
| 85 | |
| 86 | #define SUMMARY_INITIAL_COMMIT (1 << 0) |
| 87 | #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1) |
| 88 | void print_commit_summary(const char *prefix, const struct object_id *oid, |
| 89 | unsigned int flags); |
| 90 | #endif |