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