Merge branch 'ls/complete-remote-update-names'
[git.git] / sequencer.h
blobc5787c6b566bbc89caad1a099f4281fecba01766
1 #ifndef SEQUENCER_H
2 #define SEQUENCER_H
4 const char *git_path_commit_editmsg(void);
5 const char *git_path_seq_dir(void);
7 #define APPEND_SIGNOFF_DEDUP (1u << 0)
9 enum replay_action {
10 REPLAY_REVERT,
11 REPLAY_PICK,
12 REPLAY_INTERACTIVE_REBASE
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
22 struct replay_opts {
23 enum replay_action action;
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;
37 int mainline;
39 char *gpg_sign;
40 enum commit_msg_cleanup_mode default_msg_cleanup;
42 /* Merge strategy */
43 char *strategy;
44 char **xopts;
45 size_t xopts_nr, xopts_alloc;
47 /* Used by fixup/squash */
48 struct strbuf current_fixups;
49 int current_fixup_count;
51 /* placeholder commit for -i --root */
52 struct object_id squash_onto;
53 int have_squash_onto;
55 /* Only used by REPLAY_NONE */
56 struct rev_info *revs;
58 #define REPLAY_OPTS_INIT { .action = -1, .current_fixups = STRBUF_INIT }
60 /* Call this to setup defaults before parsing command line options */
61 void sequencer_init_config(struct replay_opts *opts);
62 int sequencer_pick_revisions(struct replay_opts *opts);
63 int sequencer_continue(struct replay_opts *opts);
64 int sequencer_rollback(struct replay_opts *opts);
65 int sequencer_remove_state(struct replay_opts *opts);
67 #define TODO_LIST_KEEP_EMPTY (1U << 0)
68 #define TODO_LIST_SHORTEN_IDS (1U << 1)
69 #define TODO_LIST_ABBREVIATE_CMDS (1U << 2)
70 #define TODO_LIST_REBASE_MERGES (1U << 3)
72 * When rebasing merges, commits that do have the base commit as ancestor
73 * ("cousins") are *not* rebased onto the new base by default. If those
74 * commits should be rebased onto the new base, this flag needs to be passed.
76 #define TODO_LIST_REBASE_COUSINS (1U << 4)
77 int sequencer_make_script(FILE *out, int argc, const char **argv,
78 unsigned flags);
80 int sequencer_add_exec_commands(const char *command);
81 int transform_todos(unsigned flags);
82 int check_todo_list(void);
83 int skip_unnecessary_picks(void);
84 int rearrange_squash(void);
86 extern const char sign_off_header[];
88 void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag);
89 void append_conflicts_hint(struct strbuf *msgbuf);
90 int message_is_empty(const struct strbuf *sb,
91 enum commit_msg_cleanup_mode cleanup_mode);
92 int template_untouched(const struct strbuf *sb, const char *template_file,
93 enum commit_msg_cleanup_mode cleanup_mode);
94 int update_head_with_reflog(const struct commit *old_head,
95 const struct object_id *new_head,
96 const char *action, const struct strbuf *msg,
97 struct strbuf *err);
98 void commit_post_rewrite(const struct commit *current_head,
99 const struct object_id *new_head);
101 #define SUMMARY_INITIAL_COMMIT (1 << 0)
102 #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
103 void print_commit_summary(const char *prefix, const struct object_id *oid,
104 unsigned int flags);
105 #endif