diff options
author | Nicolas Vigier <boklm@mars-attacks.org> | 2014-01-24 00:50:58 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-01-27 15:15:52 -0800 |
commit | 3253553e12d40da3bca818528f49a63c95f43aa3 (patch) | |
tree | 2238600ec94e6eca80f1443aa237e6c3f585d293 /sequencer.c | |
parent | bd3e186d811a13d8687584856f345a767e3e4d67 (diff) | |
download | git-3253553e12d40da3bca818528f49a63c95f43aa3.tar.gz |
cherry-pick, revert: add the --gpg-sign option
Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c index 90cac7b02e..bde5f047b0 100644 --- a/sequencer.c +++ b/sequencer.c @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; + char *gpg_sign; argv_array_init(&array); argv_array_push(&array, "commit"); argv_array_push(&array, "-n"); + if (opts->gpg_sign) { + gpg_sign = xmalloc(3 + strlen(opts->gpg_sign)); + sprintf(gpg_sign, "-S%s", opts->gpg_sign); + argv_array_push(&array, gpg_sign); + free(gpg_sign); + } if (opts->signoff) argv_array_push(&array, "-s"); if (!opts->edit) { @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts->mainline = git_config_int(key, value); else if (!strcmp(key, "options.strategy")) git_config_string(&opts->strategy, key, value); + else if (!strcmp(key, "options.gpg-sign")) + git_config_string(&opts->gpg_sign, key, value); else if (!strcmp(key, "options.strategy-option")) { ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc); opts->xopts[opts->xopts_nr++] = xstrdup(value); @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) } if (opts->strategy) git_config_set_in_file(opts_file, "options.strategy", opts->strategy); + if (opts->gpg_sign) + git_config_set_in_file(opts_file, "options.gpg-sign", opts->gpg_sign); if (opts->xopts) { int i; for (i = 0; i < opts->xopts_nr; i++) |