gpg-interface: allow use of a custom GPG binary
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f6667c5ee8
commit
0c5e70f041
@ -1094,6 +1094,17 @@ grep.lineNumber::
|
|||||||
grep.extendedRegexp::
|
grep.extendedRegexp::
|
||||||
If set to true, enable '--extended-regexp' option by default.
|
If set to true, enable '--extended-regexp' option by default.
|
||||||
|
|
||||||
|
gpg.program::
|
||||||
|
Use this custom program instead of "gpg" found on $PATH when
|
||||||
|
making or verifying a PGP signature. The program must support the
|
||||||
|
same command line interface as GPG, namely, to verify a detached
|
||||||
|
signature, "gpg --verify $file - <$signature" is run, and the
|
||||||
|
program is expected to signal a good signature by exiting with
|
||||||
|
code 0, and to generate an ascii-armored detached signature, the
|
||||||
|
standard input of "gpg -bsau $key" is fed with the contents to be
|
||||||
|
signed, and the program is expected to send the result to its
|
||||||
|
standard output.
|
||||||
|
|
||||||
gui.commitmsgwidth::
|
gui.commitmsgwidth::
|
||||||
Defines how wide the commit message window is in the
|
Defines how wide the commit message window is in the
|
||||||
linkgit:git-gui[1]. "75" is the default.
|
linkgit:git-gui[1]. "75" is the default.
|
||||||
|
@ -38,7 +38,9 @@ created (i.e. a lightweight tag).
|
|||||||
A GnuPG signed tag object will be created when `-s` or `-u
|
A GnuPG signed tag object will be created when `-s` or `-u
|
||||||
<key-id>` is used. When `-u <key-id>` is not used, the
|
<key-id>` is used. When `-u <key-id>` is not used, the
|
||||||
committer identity for the current user is used to find the
|
committer identity for the current user is used to find the
|
||||||
GnuPG key for signing.
|
GnuPG key for signing. The configuration variable `gpg.program`
|
||||||
|
is used to specify custom GnuPG binary.
|
||||||
|
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
@ -48,11 +50,11 @@ OPTIONS
|
|||||||
|
|
||||||
-s::
|
-s::
|
||||||
--sign::
|
--sign::
|
||||||
Make a GPG-signed tag, using the default e-mail address's key
|
Make a GPG-signed tag, using the default e-mail address's key.
|
||||||
|
|
||||||
-u <key-id>::
|
-u <key-id>::
|
||||||
--local-user=<key-id>::
|
--local-user=<key-id>::
|
||||||
Make a GPG-signed tag, using the given key
|
Make a GPG-signed tag, using the given key.
|
||||||
|
|
||||||
-f::
|
-f::
|
||||||
--force::
|
--force::
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "sigchain.h"
|
#include "sigchain.h"
|
||||||
|
|
||||||
static char *configured_signing_key;
|
static char *configured_signing_key;
|
||||||
|
static const char *gpg_program = "gpg";
|
||||||
|
|
||||||
void set_signing_key(const char *key)
|
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)
|
int git_gpg_config(const char *var, const char *value, void *cb)
|
||||||
{
|
{
|
||||||
if (!strcmp(var, "user.signingkey")) {
|
if (!strcmp(var, "user.signingkey")) {
|
||||||
|
set_signing_key(value);
|
||||||
|
}
|
||||||
|
if (!strcmp(var, "gpg.program")) {
|
||||||
if (!value)
|
if (!value)
|
||||||
return config_error_nonbool(var);
|
return config_error_nonbool(var);
|
||||||
set_signing_key(value);
|
gpg_program = xstrdup(value);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -46,7 +50,7 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
|
|||||||
gpg.argv = args;
|
gpg.argv = args;
|
||||||
gpg.in = -1;
|
gpg.in = -1;
|
||||||
gpg.out = -1;
|
gpg.out = -1;
|
||||||
args[0] = "gpg";
|
args[0] = gpg_program;
|
||||||
args[1] = "-bsau";
|
args[1] = "-bsau";
|
||||||
args[2] = signing_key;
|
args[2] = signing_key;
|
||||||
args[3] = NULL;
|
args[3] = NULL;
|
||||||
@ -101,10 +105,11 @@ int verify_signed_buffer(const char *payload, size_t payload_size,
|
|||||||
struct strbuf *gpg_output)
|
struct strbuf *gpg_output)
|
||||||
{
|
{
|
||||||
struct child_process gpg;
|
struct child_process gpg;
|
||||||
const char *args_gpg[] = {"gpg", "--verify", "FILE", "-", NULL};
|
const char *args_gpg[] = {NULL, "--verify", "FILE", "-", NULL};
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
|
|
||||||
|
args_gpg[0] = gpg_program;
|
||||||
fd = git_mkstemp(path, PATH_MAX, ".git_vtag_tmpXXXXXX");
|
fd = git_mkstemp(path, PATH_MAX, ".git_vtag_tmpXXXXXX");
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return error("could not create temporary file '%s': %s",
|
return error("could not create temporary file '%s': %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user