summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-31 22:39:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-31 22:39:08 (GMT)
commitb21089db6a6006bcf9233f0d8592044ca5553c6a (patch)
tree3180d1a82829f4d9480e43bf68a5f1a4725aa31b /transport-helper.c
parent5b6211aee1f042a6961ef8a6bd8286db51bfc513 (diff)
parent68c757f2199911005918aba45aa8ae0fecc72074 (diff)
downloadgit-b21089db6a6006bcf9233f0d8592044ca5553c6a.zip
git-b21089db6a6006bcf9233f0d8592044ca5553c6a.tar.gz
git-b21089db6a6006bcf9233f0d8592044ca5553c6a.tar.bz2
Merge branch 'db/push-sign-if-asked'
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
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 68e498e..99f1ace 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -257,7 +257,6 @@ static const char *boolean_options[] = {
TRANS_OPT_THIN,
TRANS_OPT_KEEP,
TRANS_OPT_FOLLOWTAGS,
- TRANS_OPT_PUSH_CERT
};
static int set_helper_option(struct transport *transport,
@@ -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,
for_each_string_list_item(cas_option, &cas_options)
set_helper_option(transport, "cas", cas_option->string);
-
- 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);
- }
+ set_common_push_options(transport, data->name, flags);
strbuf_addch(&buf, '\n');
sendline(data, &buf);
@@ -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);
- }
-
+ set_common_push_options(transport, data->name, flags);
if (flags & TRANSPORT_PUSH_FORCE) {
if (set_helper_option(transport, "force", "true") != 0)
warning("helper %s does not support 'force'", data->name);