upload-pack: express constants in terms of the_hash_algo
[git/debian.git] / sequencer.h
blobc986bc825161f1f4702a0cd435c6d9705e3be2df
1 #ifndef SEQUENCER_H
2 #define SEQUENCER_H
4 #include "cache.h"
5 #include "strbuf.h"
7 struct commit;
9 const char *git_path_commit_editmsg(void);
10 const char *git_path_seq_dir(void);
12 #define APPEND_SIGNOFF_DEDUP (1u << 0)
14 enum replay_action {
15 REPLAY_REVERT,
16 REPLAY_PICK,
17 REPLAY_INTERACTIVE_REBASE
20 enum commit_msg_cleanup_mode {
21 COMMIT_MSG_CLEANUP_SPACE,
22 COMMIT_MSG_CLEANUP_NONE,
23 COMMIT_MSG_CLEANUP_SCISSORS,
24 COMMIT_MSG_CLEANUP_ALL
27 struct replay_opts {
28 enum replay_action action;
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;
37 int allow_empty;
38 int allow_empty_message;
39 int keep_redundant_commits;
40 int verbose;
42 int mainline;
44 char *gpg_sign;
45 enum commit_msg_cleanup_mode default_msg_cleanup;
47 /* Merge strategy */
48 char *strategy;
49 char **xopts;
50 size_t xopts_nr, xopts_alloc;
52 /* Used by fixup/squash */
53 struct strbuf current_fixups;
54 int current_fixup_count;
56 /* placeholder commit for -i --root */
57 struct object_id squash_onto;
58 int have_squash_onto;
60 /* Only used by REPLAY_NONE */
61 struct rev_info *revs;
63 #define REPLAY_OPTS_INIT { .action = -1, .current_fixups = STRBUF_INIT }
65 /* Call this to setup defaults before parsing command line options */
66 void sequencer_init_config(struct replay_opts *opts);
67 int sequencer_pick_revisions(struct replay_opts *opts);
68 int sequencer_continue(struct replay_opts *opts);
69 int sequencer_rollback(struct replay_opts *opts);
70 int sequencer_remove_state(struct replay_opts *opts);
72 #define TODO_LIST_KEEP_EMPTY (1U << 0)
73 #define TODO_LIST_SHORTEN_IDS (1U << 1)
74 #define TODO_LIST_ABBREVIATE_CMDS (1U << 2)
75 #define TODO_LIST_REBASE_MERGES (1U << 3)
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.
81 #define TODO_LIST_REBASE_COUSINS (1U << 4)
82 int sequencer_make_script(FILE *out, int argc, const char **argv,
83 unsigned flags);
85 int sequencer_add_exec_commands(const char *command);
86 int transform_todos(unsigned flags);
87 int check_todo_list(void);
88 int skip_unnecessary_picks(void);
89 int rearrange_squash(void);
91 extern const char sign_off_header[];
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.
99 void append_signoff(struct strbuf *msgbuf, size_t ignore_footer, unsigned flag);
101 void append_conflicts_hint(struct strbuf *msgbuf);
102 int message_is_empty(const struct strbuf *sb,
103 enum commit_msg_cleanup_mode cleanup_mode);
104 int template_untouched(const struct strbuf *sb, const char *template_file,
105 enum commit_msg_cleanup_mode cleanup_mode);
106 int 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);
110 void commit_post_rewrite(const struct commit *current_head,
111 const struct object_id *new_head);
113 #define SUMMARY_INITIAL_COMMIT (1 << 0)
114 #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
115 void print_commit_summary(const char *prefix, const struct object_id *oid,
116 unsigned int flags);
117 #endif