am: rename read_author_script()
[git/git.git] / sequencer.h
CommitLineData
26ae337b
RR
1#ifndef SEQUENCER_H
2#define SEQUENCER_H
3
ef3ca954
EN
4#include "cache.h"
5#include "strbuf.h"
6
7struct commit;
8
66618a50 9const char *git_path_commit_editmsg(void);
8a2a0f53 10const char *git_path_seq_dir(void);
26ae337b 11
bab4d109
BC
12#define APPEND_SIGNOFF_DEDUP (1u << 0)
13
043a4492
RR
14enum replay_action {
15 REPLAY_REVERT,
84583957
JS
16 REPLAY_PICK,
17 REPLAY_INTERACTIVE_REBASE
043a4492
RR
18};
19
28d6daed
PW
20enum commit_msg_cleanup_mode {
21 COMMIT_MSG_CLEANUP_SPACE,
22 COMMIT_MSG_CLEANUP_NONE,
23 COMMIT_MSG_CLEANUP_SCISSORS,
24 COMMIT_MSG_CLEANUP_ALL
25};
26
043a4492
RR
27struct replay_opts {
28 enum replay_action action;
043a4492
RR
29
30 /* Boolean options */
31 int edit;
32 int record_origin;
33 int no_commit;
34 int signoff;
35 int allow_ff;
36 int allow_rerere_auto;
df478b74 37 int allow_empty;
4bee9584 38 int allow_empty_message;
b27cfb0d 39 int keep_redundant_commits;
556907f1 40 int verbose;
043a4492
RR
41
42 int mainline;
43
03a4e260 44 char *gpg_sign;
28d6daed 45 enum commit_msg_cleanup_mode default_msg_cleanup;
3253553e 46
043a4492 47 /* Merge strategy */
03a4e260
JS
48 char *strategy;
49 char **xopts;
043a4492
RR
50 size_t xopts_nr, xopts_alloc;
51
e12a7ef5
JS
52 /* Used by fixup/squash */
53 struct strbuf current_fixups;
54 int current_fixup_count;
55
d87d48b2
JS
56 /* placeholder commit for -i --root */
57 struct object_id squash_onto;
58 int have_squash_onto;
59
043a4492
RR
60 /* Only used by REPLAY_NONE */
61 struct rev_info *revs;
62};
e12a7ef5 63#define REPLAY_OPTS_INIT { .action = -1, .current_fixups = STRBUF_INIT }
043a4492 64
28d6daed
PW
65/* Call this to setup defaults before parsing command line options */
66void sequencer_init_config(struct replay_opts *opts);
043a4492 67int sequencer_pick_revisions(struct replay_opts *opts);
2863584f
JS
68int sequencer_continue(struct replay_opts *opts);
69int sequencer_rollback(struct replay_opts *opts);
70int sequencer_remove_state(struct replay_opts *opts);
043a4492 71
313a48ea
LB
72#define TODO_LIST_KEEP_EMPTY (1U << 0)
73#define TODO_LIST_SHORTEN_IDS (1U << 1)
d8ae6c84 74#define TODO_LIST_ABBREVIATE_CMDS (1U << 2)
1644c73c 75#define TODO_LIST_REBASE_MERGES (1U << 3)
7543f6f4
JS
76/*
77 * When rebasing merges, commits that do have the base commit as ancestor
78 * ("cousins") are *not* rebased onto the new base by default. If those
79 * commits should be rebased onto the new base, this flag needs to be passed.
80 */
81#define TODO_LIST_REBASE_COUSINS (1U << 4)
313a48ea
LB
82int sequencer_make_script(FILE *out, int argc, const char **argv,
83 unsigned flags);
62db5247 84
0cce4a27 85int sequencer_add_exec_commands(const char *command);
313a48ea 86int transform_todos(unsigned flags);
94399949 87int check_todo_list(void);
cdac2b01 88int skip_unnecessary_picks(void);
c44a4c65 89int rearrange_squash(void);
3546c8d9 90
5ed75e2a
MV
91extern const char sign_off_header[];
92
66e83d9b
JK
93/*
94 * Append a signoff to the commit message in "msgbuf". The ignore_footer
95 * parameter specifies the number of bytes at the end of msgbuf that should
96 * not be considered at all. I.e., they are not checked for existing trailers,
97 * and the new signoff will be spliced into the buffer before those bytes.
98 */
99void append_signoff(struct strbuf *msgbuf, size_t ignore_footer, unsigned flag);
100
75c961b7 101void append_conflicts_hint(struct strbuf *msgbuf);
d0aaa46f
PW
102int message_is_empty(const struct strbuf *sb,
103 enum commit_msg_cleanup_mode cleanup_mode);
104int template_untouched(const struct strbuf *sb, const char *template_file,
105 enum commit_msg_cleanup_mode cleanup_mode);
0505d604
PW
106int update_head_with_reflog(const struct commit *old_head,
107 const struct object_id *new_head,
108 const char *action, const struct strbuf *msg,
109 struct strbuf *err);
a87a6f3c
PW
110void commit_post_rewrite(const struct commit *current_head,
111 const struct object_id *new_head);
5ed75e2a 112
e47c6caf
PW
113#define SUMMARY_INITIAL_COMMIT (1 << 0)
114#define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
115void print_commit_summary(const char *prefix, const struct object_id *oid,
116 unsigned int flags);
26ae337b 117#endif