diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-09-08 21:39:38 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-08 21:39:38 -0700 |
commit | 49981d8a250837019b4a14f44d471fc6ff7e334f (patch) | |
tree | c3394268eaaade296d7de692fe7e76bacb3be97b /send-pack.c | |
parent | Prepare for 2.9.4 (diff) | |
parent | Git 2.10 (diff) | |
download | tgif-49981d8a250837019b4a14f44d471fc6ff7e334f.tar.xz |
Start maintenance track for 2.10.x series
Diffstat (limited to 'send-pack.c')
-rw-r--r-- | send-pack.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/send-pack.c b/send-pack.c index 1f85c56747..90f2ac51a7 100644 --- a/send-pack.c +++ b/send-pack.c @@ -260,6 +260,7 @@ static int generate_push_cert(struct strbuf *req_buf, const char *push_cert_nonce) { const struct ref *ref; + struct string_list_item *item; char *signing_key = xstrdup(get_signing_key()); const char *cp, *np; struct strbuf cert = STRBUF_INIT; @@ -276,6 +277,9 @@ static int generate_push_cert(struct strbuf *req_buf, } if (push_cert_nonce[0]) strbuf_addf(&cert, "nonce %s\n", push_cert_nonce); + if (args->push_options) + for_each_string_list_item(item, args->push_options) + strbuf_addf(&cert, "push-option %s\n", item->string); strbuf_addstr(&cert, "\n"); for (ref = remote_refs; ref; ref = ref->next) { @@ -370,6 +374,8 @@ int send_pack(struct send_pack_args *args, int agent_supported = 0; int use_atomic = 0; int atomic_supported = 0; + int use_push_options = 0; + int push_options_supported = 0; unsigned cmds_sent = 0; int ret; struct async demux; @@ -392,6 +398,8 @@ int send_pack(struct send_pack_args *args, args->use_thin_pack = 0; if (server_supports("atomic")) atomic_supported = 1; + if (server_supports("push-options")) + push_options_supported = 1; if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) { int len; @@ -418,6 +426,11 @@ int send_pack(struct send_pack_args *args, use_atomic = atomic_supported && args->atomic; + if (args->push_options && !push_options_supported) + die(_("the receiving end does not support push options")); + + use_push_options = push_options_supported && args->push_options; + if (status_report) strbuf_addstr(&cap_buf, " report-status"); if (use_sideband) @@ -426,6 +439,8 @@ int send_pack(struct send_pack_args *args, strbuf_addstr(&cap_buf, " quiet"); if (use_atomic) strbuf_addstr(&cap_buf, " atomic"); + if (use_push_options) + strbuf_addstr(&cap_buf, " push-options"); if (agent_supported) strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized()); @@ -512,6 +527,18 @@ int send_pack(struct send_pack_args *args, strbuf_release(&req_buf); strbuf_release(&cap_buf); + if (use_push_options) { + struct string_list_item *item; + struct strbuf sb = STRBUF_INIT; + + for_each_string_list_item(item, args->push_options) + packet_buf_write(&sb, "%s", item->string); + + write_or_die(out, sb.buf, sb.len); + packet_flush(out); + strbuf_release(&sb); + } + if (use_sideband && cmds_sent) { memset(&demux, 0, sizeof(demux)); demux.proc = sideband_demux; |