repack -ad: prune the list of shallow commits
[git/raj.git] / sequencer.h
blobc751c9d6e4f78e7d9e2700dcc3fb3157961fb049
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[];
93 void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag);
94 void append_conflicts_hint(struct strbuf *msgbuf);
95 int message_is_empty(const struct strbuf *sb,
96 enum commit_msg_cleanup_mode cleanup_mode);
97 int template_untouched(const struct strbuf *sb, const char *template_file,
98 enum commit_msg_cleanup_mode cleanup_mode);
99 int update_head_with_reflog(const struct commit *old_head,
100 const struct object_id *new_head,
101 const char *action, const struct strbuf *msg,
102 struct strbuf *err);
103 void commit_post_rewrite(const struct commit *current_head,
104 const struct object_id *new_head);
106 #define SUMMARY_INITIAL_COMMIT (1 << 0)
107 #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
108 void print_commit_summary(const char *prefix, const struct object_id *oid,
109 unsigned int flags);
110 #endif