diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-01-05 23:00:38 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-05 23:00:49 +0400 |
commit | 9d3d78435f2735b74afc74e9c5a735c27c026d33 (patch) | |
tree | 8f66df5b090f6163698d66cc9dd7a522ae359dfd /gpg-interface.c | |
parent | 0074d18dc0d816f9842d3e0e1cd0b26341715b37 (diff) | |
parent | 0c5e70f041bfda8b3899d13694a9093b41fafa19 (diff) |
Merge branch 'jc/signed-commit' and 'jc/pull-signed-tag'
They both use the extended headers in commit objects, and the former has
necessary infrastructure to show them that is useful to view the result of
the latter.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gpg-interface.c')
-rw-r--r-- | gpg-interface.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gpg-interface.c b/gpg-interface.c index ff232c8c5d..18630ff8da 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -5,6 +5,7 @@ #include "sigchain.h" static char *configured_signing_key; +static const char *gpg_program = "gpg"; void set_signing_key(const char *key) { @@ -15,9 +16,12 @@ void set_signing_key(const char *key) int git_gpg_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "user.signingkey")) { + set_signing_key(value); + } + if (!strcmp(var, "gpg.program")) { if (!value) return config_error_nonbool(var); - set_signing_key(value); + gpg_program = xstrdup(value); } return 0; } @@ -46,7 +50,7 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig gpg.argv = args; gpg.in = -1; gpg.out = -1; - args[0] = "gpg"; + args[0] = gpg_program; args[1] = "-bsau"; args[2] = signing_key; args[3] = NULL; @@ -101,10 +105,11 @@ int verify_signed_buffer(const char *payload, size_t payload_size, struct strbuf *gpg_output) { struct child_process gpg; - const char *args_gpg[] = {"gpg", "--verify", "FILE", "-", NULL}; + const char *args_gpg[] = {NULL, "--verify", "FILE", "-", NULL}; char path[PATH_MAX]; int fd, ret; + args_gpg[0] = gpg_program; fd = git_mkstemp(path, PATH_MAX, ".git_vtag_tmpXXXXXX"); if (fd < 0) return error("could not create temporary file '%s': %s", |