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