diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2017-11-24 12:07:56 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-24 14:44:18 +0100 |
commit | b36c5908135889bd9c48a8d44d4e07f59bf799ef (patch) | |
tree | 5319aebe315eb106d7b4e47164740c50295ce97d /sequencer.c | |
parent | sequencer: simplify adding Signed-off-by: trailer (diff) | |
download | git-b36c5908135889bd9c48a8d44d4e07f59bf799ef.tar.xz git-b36c5908135889bd9c48a8d44d4e07f59bf799ef.zip |
sequencer: load commit related config
Load default values for message cleanup and gpg signing of commits in
preparation for committing without forking 'git commit'. Note that we
interpret commit.cleanup=scissors to mean COMMIT_MSG_CLEANUP_SPACE to
be consistent with 'git commit'
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c index a9e0ad49fb..22392d954b 100644 --- a/sequencer.c +++ b/sequencer.c @@ -688,6 +688,40 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, return run_command(&cmd); } +static enum commit_msg_cleanup_mode default_msg_cleanup = + COMMIT_MSG_CLEANUP_NONE; +static char *default_gpg_sign; + +int git_sequencer_config(const char *k, const char *v, void *cb) +{ + if (!strcmp(k, "commit.cleanup")) { + int status; + const char *s; + + status = git_config_string(&s, k, v); + if (status) + return status; + + if (!strcmp(s, "verbatim")) + default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE; + else if (!strcmp(s, "whitespace")) + default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE; + else if (!strcmp(s, "strip")) + default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL; + else if (!strcmp(s, "scissors")) + default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE; + + return status; + } + + if (!strcmp(k, "commit.gpgsign")) { + default_gpg_sign = git_config_bool(k, v) ? "" : NULL; + return 0; + } + + return git_gpg_config(k, v, NULL); +} + static int rest_is_empty(const struct strbuf *sb, int start) { int i, eol; |