1#ifndef SEQUENCER_H
2#define SEQUENCER_H
34
const char *git_path_commit_editmsg(void);
5const char *git_path_seq_dir(void);
67
#define APPEND_SIGNOFF_DEDUP (1u << 0)
89
enum replay_action {
10REPLAY_REVERT,
11REPLAY_PICK,
12REPLAY_INTERACTIVE_REBASE
13};
1415
enum commit_msg_cleanup_mode {
16COMMIT_MSG_CLEANUP_SPACE,
17COMMIT_MSG_CLEANUP_NONE,
18COMMIT_MSG_CLEANUP_SCISSORS,
19COMMIT_MSG_CLEANUP_ALL
20};
2122
struct replay_opts {
23enum replay_action action;
2425
/* Boolean options */
26int edit;
27int record_origin;
28int no_commit;
29int signoff;
30int allow_ff;
31int allow_rerere_auto;
32int allow_empty;
33int allow_empty_message;
34int keep_redundant_commits;
35int verbose;
3637
int mainline;
3839
char *gpg_sign;
40enum commit_msg_cleanup_mode default_msg_cleanup;
4142
/* Merge strategy */
43char *strategy;
44char **xopts;
45size_t xopts_nr, xopts_alloc;
4647
/* Used by fixup/squash */
48struct strbuf current_fixups;
49int current_fixup_count;
5051
/* placeholder commit for -i --root */
52struct object_id squash_onto;
53int have_squash_onto;
5455
/* Only used by REPLAY_NONE */
56struct rev_info *revs;
57};
58#define REPLAY_OPTS_INIT { .action = -1, .current_fixups = STRBUF_INIT }
5960
/* Call this to setup defaults before parsing command line options */
61void sequencer_init_config(struct replay_opts *opts);
62int sequencer_pick_revisions(struct replay_opts *opts);
63int sequencer_continue(struct replay_opts *opts);
64int sequencer_rollback(struct replay_opts *opts);
65int sequencer_remove_state(struct replay_opts *opts);
6667
#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)
71/*
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.
75*/
76#define TODO_LIST_REBASE_COUSINS (1U << 4)
77int sequencer_make_script(FILE *out, int argc, const char **argv,
78unsigned flags);
7980
int sequencer_add_exec_commands(const char *command);
81int transform_todos(unsigned flags);
82int check_todo_list(void);
83int skip_unnecessary_picks(void);
84int rearrange_squash(void);
8586
extern const char sign_off_header[];
8788
void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag);
89void append_conflicts_hint(struct strbuf *msgbuf);
90int message_is_empty(const struct strbuf *sb,
91enum commit_msg_cleanup_mode cleanup_mode);
92int template_untouched(const struct strbuf *sb, const char *template_file,
93enum commit_msg_cleanup_mode cleanup_mode);
94int update_head_with_reflog(const struct commit *old_head,
95const struct object_id *new_head,
96const char *action, const struct strbuf *msg,
97struct strbuf *err);
98void commit_post_rewrite(const struct commit *current_head,
99const struct object_id *new_head);
100101
#define SUMMARY_INITIAL_COMMIT (1 << 0)
102#define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
103void print_commit_summary(const char *prefix, const struct object_id *oid,
104unsigned int flags);
105#endif