diff options
author | Dave Borowitz <dborowitz@google.com> | 2015-08-19 11:26:46 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-19 12:58:45 -0700 |
commit | 30261094b1f7fdcba3b7a1f396e43891cd998149 (patch) | |
tree | 1ad9cc07d3c3dc5fb1a07c878be7f9b0fe2d4dde /transport.c | |
parent | 068c77a5189584de2a8d9c2ad29e2370159444ae (diff) | |
download | git-30261094b1f7fdcba3b7a1f396e43891cd998149.tar.gz |
push: support signing pushes iff the server supports it
Add a new flag --sign=true (or --sign=false), which means the same
thing as the original --signed (or --no-signed). Give it a third
value --sign=if-asked to tell push and send-pack to send a push
certificate if and only if the server advertised a push cert nonce.
If not, warn the user that their push may not be as secure as they
thought.
Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/transport.c b/transport.c index 39a1a66287..12837254d5 100644 --- a/transport.c +++ b/transport.c @@ -828,10 +828,16 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re args.progress = transport->progress; args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN); args.porcelain = !!(flags & TRANSPORT_PUSH_PORCELAIN); - args.push_cert = !!(flags & TRANSPORT_PUSH_CERT); args.atomic = !!(flags & TRANSPORT_PUSH_ATOMIC); args.url = transport->url; + if (flags & TRANSPORT_PUSH_CERT_ALWAYS) + args.push_cert = SEND_PACK_PUSH_CERT_ALWAYS; + else if (flags & TRANSPORT_PUSH_CERT_IF_ASKED) + args.push_cert = SEND_PACK_PUSH_CERT_IF_ASKED; + else + args.push_cert = SEND_PACK_PUSH_CERT_NEVER; + ret = send_pack(&args, data->fd, data->conn, remote_refs, &data->extra_have); |