sequencer: extract helper to update active_cache_tree
[git/git.git] / sequencer.h
CommitLineData
26ae337b
RR
1#ifndef SEQUENCER_H
2#define SEQUENCER_H
3
66618a50 4const char *git_path_commit_editmsg(void);
8a2a0f53 5const char *git_path_seq_dir(void);
26ae337b 6
bab4d109
BC
7#define APPEND_SIGNOFF_DEDUP (1u << 0)
8
043a4492
RR
9enum replay_action {
10 REPLAY_REVERT,
84583957
JS
11 REPLAY_PICK,
12 REPLAY_INTERACTIVE_REBASE
043a4492
RR
13};
14
28d6daed
PW
15enum 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
043a4492
RR
22struct replay_opts {
23 enum replay_action action;
043a4492
RR
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;
df478b74 32 int allow_empty;
4bee9584 33 int allow_empty_message;
b27cfb0d 34 int keep_redundant_commits;
556907f1 35 int verbose;
043a4492
RR
36
37 int mainline;
38
03a4e260 39 char *gpg_sign;
28d6daed 40 enum commit_msg_cleanup_mode default_msg_cleanup;
3253553e 41
043a4492 42 /* Merge strategy */
03a4e260
JS
43 char *strategy;
44 char **xopts;
043a4492
RR
45 size_t xopts_nr, xopts_alloc;
46
47 /* Only used by REPLAY_NONE */
48 struct rev_info *revs;
49};
2863584f 50#define REPLAY_OPTS_INIT { -1 }
043a4492 51
28d6daed
PW
52/* Call this to setup defaults before parsing command line options */
53void sequencer_init_config(struct replay_opts *opts);
043a4492 54int sequencer_pick_revisions(struct replay_opts *opts);
2863584f
JS
55int sequencer_continue(struct replay_opts *opts);
56int sequencer_rollback(struct replay_opts *opts);
57int sequencer_remove_state(struct replay_opts *opts);
043a4492 58
313a48ea
LB
59#define TODO_LIST_KEEP_EMPTY (1U << 0)
60#define TODO_LIST_SHORTEN_IDS (1U << 1)
d8ae6c84 61#define TODO_LIST_ABBREVIATE_CMDS (1U << 2)
1644c73c 62#define TODO_LIST_REBASE_MERGES (1U << 3)
7543f6f4
JS
63/*
64 * When rebasing merges, commits that do have the base commit as ancestor
65 * ("cousins") are *not* rebased onto the new base by default. If those
66 * commits should be rebased onto the new base, this flag needs to be passed.
67 */
68#define TODO_LIST_REBASE_COUSINS (1U << 4)
313a48ea
LB
69int sequencer_make_script(FILE *out, int argc, const char **argv,
70 unsigned flags);
62db5247 71
0cce4a27 72int sequencer_add_exec_commands(const char *command);
313a48ea 73int transform_todos(unsigned flags);
94399949 74int check_todo_list(void);
cdac2b01 75int skip_unnecessary_picks(void);
c44a4c65 76int rearrange_squash(void);
3546c8d9 77
5ed75e2a
MV
78extern const char sign_off_header[];
79
bab4d109 80void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag);
75c961b7 81void append_conflicts_hint(struct strbuf *msgbuf);
d0aaa46f
PW
82int message_is_empty(const struct strbuf *sb,
83 enum commit_msg_cleanup_mode cleanup_mode);
84int template_untouched(const struct strbuf *sb, const char *template_file,
85 enum commit_msg_cleanup_mode cleanup_mode);
0505d604
PW
86int update_head_with_reflog(const struct commit *old_head,
87 const struct object_id *new_head,
88 const char *action, const struct strbuf *msg,
89 struct strbuf *err);
a87a6f3c
PW
90void commit_post_rewrite(const struct commit *current_head,
91 const struct object_id *new_head);
5ed75e2a 92
e47c6caf
PW
93#define SUMMARY_INITIAL_COMMIT (1 << 0)
94#define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
95void print_commit_summary(const char *prefix, const struct object_id *oid,
96 unsigned int flags);
26ae337b 97#endif