The client side codepaths in "git push" have been cleaned up
and the user can request to perform an optional "signed push",
i.e. sign only when the other end accepts signed push.
* db/push-sign-if-asked:
push: add a config option push.gpgSign for default signed pushes
push: support signing pushes iff the server supports it
builtin/send-pack.c: use parse_options API
config.c: rename git_config_maybe_bool_text and export it as git_parse_maybe_bool
transport: remove git_transport_options.push_cert
gitremote-helpers.txt: document pushcert option
Documentation/git-send-pack.txt: document --signed
Documentation/git-send-pack.txt: wrap long synopsis line
Documentation/git-push.txt: document when --signed may fail
@ -9,7 +9,10 @@ git-send-pack - Push objects over Git protocol to another repository
@@ -9,7 +9,10 @@ git-send-pack - Push objects over Git protocol to another repository
@ -67,6 +70,17 @@ be in a separate packet, and the list must end with a flush packet.
@@ -67,6 +70,17 @@ be in a separate packet, and the list must end with a flush packet.
fails to update then the entire push will fail without changing any
refs.
--[no-]signed::
--sign=(true|false|if-asked)::
GPG-sign the push request to update refs on the receiving
side, to allow it to be checked by the hooks and/or be
logged. If `false` or `--no-signed`, no signing will be
attempted. If `true` or `--signed`, the push will fail if the
server does not support signed pushes. If set to `if-asked`,
sign if and only if the server supports signed pushes. The push
will also fail if the actual call to `gpg --sign` fails. See
linkgit:git-receive-pack[1] for the details on the receiving end.
<host>::
A remote host to house the repository. When this
part is specified, 'git-receive-pack' is invoked via
@ -448,6 +448,9 @@ set by Git if the remote helper has the 'option' capability.
@@ -448,6 +448,9 @@ set by Git if the remote helper has the 'option' capability.
'option update-shallow {'true'|'false'}::
Allow to extend .git/shallow if the new refs require it.
static int set_helper_option(struct transport *transport,
@ -764,6 +763,21 @@ static int push_update_refs_status(struct helper_data *data,
@@ -764,6 +763,21 @@ static int push_update_refs_status(struct helper_data *data,
return ret;
}
static void set_common_push_options(struct transport *transport,
const char *name, int flags)
{
if (flags & TRANSPORT_PUSH_DRY_RUN) {
if (set_helper_option(transport, "dry-run", "true") != 0)
die("helper %s does not support dry-run", name);
} else if (flags & TRANSPORT_PUSH_CERT_ALWAYS) {
if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0)
die("helper %s does not support --signed", name);
} else if (flags & TRANSPORT_PUSH_CERT_IF_ASKED) {
if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "if-asked") != 0)
die("helper %s does not support --signed=if-asked", name);
}
}
static int push_refs_with_push(struct transport *transport,
struct ref *remote_refs, int flags)
{
@ -831,14 +845,7 @@ static int push_refs_with_push(struct transport *transport,
@@ -831,14 +845,7 @@ static int push_refs_with_push(struct transport *transport,
@ -859,14 +866,7 @@ static int push_refs_with_export(struct transport *transport,
@@ -859,14 +866,7 @@ static int push_refs_with_export(struct transport *transport,
if (!data->refspecs)
die("remote-helper doesn't support push; refspec needed");
if (flags & TRANSPORT_PUSH_DRY_RUN) {
if (set_helper_option(transport, "dry-run", "true") != 0)
die("helper %s does not support dry-run", data->name);
} else if (flags & TRANSPORT_PUSH_CERT) {
if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0)
die("helper %s does not support --signed", data->name);