summaryrefslogtreecommitdiff
path: root/sequencer.h
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2017-12-13 11:46:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-13 19:15:14 (GMT)
commit28d6daed4f119940ace31e523b3b272d3d153d04 (patch)
tree66856848873f995175be96b7052b8962e43ea287 /sequencer.h
parentdb9476b50348c9d7e6a076cf4bd9ce0e70995439 (diff)
downloadgit-28d6daed4f119940ace31e523b3b272d3d153d04.zip
git-28d6daed4f119940ace31e523b3b272d3d153d04.tar.gz
git-28d6daed4f119940ace31e523b3b272d3d153d04.tar.bz2
sequencer: improve config handling
The previous config handling relied on global variables, called git_default_config() even when the key had already been handled by git_sequencer_config() and did not initialize the diff configuration variables. Improve this by: i) loading the default values for message cleanup and gpg signing of commits into struct replay_opts; ii) restructuring the code to return immediately once a key is handled; and iii) calling git_diff_basic_config(). Note that unfortunately it is not possible to return early if the key is handled by git_gpg_config() as it does not indicate to the caller if the key has been handled or not. The sequencer should probably have been calling git_diff_basic_config() before as it creates a patch when there are conflicts. The shell version uses 'diff-tree' to create the patch so calling git_diff_basic_config() should match that. Although 'git commit' calls git_diff_ui_config() I don't think the output of print_commit_summary() is affected by anything that is loaded by that as print_commit_summary() always turns on rename detection so would ignore the value in the user's configuration anyway. The other values loaded by git_diff_ui_config() are about the formatting of patches so are not relevant to print_commit_summary(). Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.h')
-rw-r--r--sequencer.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/sequencer.h b/sequencer.h
index 77cb174..3a5072c 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -11,6 +11,13 @@ enum replay_action {
REPLAY_INTERACTIVE_REBASE
};
+enum commit_msg_cleanup_mode {
+ COMMIT_MSG_CLEANUP_SPACE,
+ COMMIT_MSG_CLEANUP_NONE,
+ COMMIT_MSG_CLEANUP_SCISSORS,
+ COMMIT_MSG_CLEANUP_ALL
+};
+
struct replay_opts {
enum replay_action action;
@@ -29,6 +36,7 @@ struct replay_opts {
int mainline;
char *gpg_sign;
+ enum commit_msg_cleanup_mode default_msg_cleanup;
/* Merge strategy */
char *strategy;
@@ -40,6 +48,8 @@ struct replay_opts {
};
#define REPLAY_OPTS_INIT { -1 }
+/* Call this to setup defaults before parsing command line options */
+void sequencer_init_config(struct replay_opts *opts);
int sequencer_pick_revisions(struct replay_opts *opts);
int sequencer_continue(struct replay_opts *opts);
int sequencer_rollback(struct replay_opts *opts);
@@ -57,15 +67,6 @@ extern const char sign_off_header[];
void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag);
void append_conflicts_hint(struct strbuf *msgbuf);
-int git_sequencer_config(const char *k, const char *v, void *cb);
-
-enum commit_msg_cleanup_mode {
- COMMIT_MSG_CLEANUP_SPACE,
- COMMIT_MSG_CLEANUP_NONE,
- COMMIT_MSG_CLEANUP_SCISSORS,
- COMMIT_MSG_CLEANUP_ALL
-};
-
int message_is_empty(const struct strbuf *sb,
enum commit_msg_cleanup_mode cleanup_mode);
int template_untouched(const struct strbuf *sb, const char *template_file,