diff options
author | Josh Steadmon <steadmon@google.com> | 2020-11-12 02:29:28 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-12 05:26:53 +0300 |
commit | 8073d75bbf268da6da36f06ab2d1f0d9018bd74d (patch) | |
tree | adcf707db48ab0d5b151f0bbd1462576f0ed05c0 /builtin/receive-pack.c | |
parent | 791e1adf2236a9bb3e6a40da64c00614e39e15b7 (diff) |
receive-pack: advertise session ID in v0 capabilities
When transfer.advertiseSID is true, advertise receive-pack's session ID
via the new session-id capability.
Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r-- | builtin/receive-pack.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index bb9909c52e..6ed498b6c7 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -54,6 +54,7 @@ static int receive_unpack_limit = -1; static int transfer_unpack_limit = -1; static int advertise_atomic_push = 1; static int advertise_push_options; +static int advertise_sid; static int unpack_limit = 100; static off_t max_input_size; static int report_status; @@ -248,6 +249,11 @@ static int receive_pack_config(const char *var, const char *value, void *cb) return 0; } + if (strcmp(var, "transfer.advertisesid") == 0) { + advertise_sid = git_config_bool(var, value); + return 0; + } + return git_default_config(var, value, cb); } @@ -268,6 +274,8 @@ static void show_ref(const char *path, const struct object_id *oid) strbuf_addf(&cap, " push-cert=%s", push_cert_nonce); if (advertise_push_options) strbuf_addstr(&cap, " push-options"); + if (advertise_sid) + strbuf_addf(&cap, " session-id=%s", trace2_session_id()); strbuf_addf(&cap, " object-format=%s", the_hash_algo->name); strbuf_addf(&cap, " agent=%s", git_user_agent_sanitized()); packet_write_fmt(1, "%s %s%c%s\n", |