Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Steadmon <steadmon@google.com>2020-11-12 02:29:33 +0300
committerJunio C Hamano <gitster@pobox.com>2020-11-12 05:26:53 +0300
commit8c4870029dd084bc030e1b5383fa13358bcce236 (patch)
treec76c15397ec6def532a8d1737cee33de7785d962 /send-pack.c
parent829594677c3cd02f7d88b3cd3c72ad06f68faa14 (diff)
send-pack: advertise session ID in capabilities
When the server sent a session-id capability and transfer.advertiseSID is true, advertise send-pack's own session ID back to the server. Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/send-pack.c b/send-pack.c
index eb4a44270b..bda65c98f9 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -424,6 +424,7 @@ int send_pack(struct send_pack_args *args,
int use_sideband = 0;
int quiet_supported = 0;
int agent_supported = 0;
+ int advertise_sid = 0;
int use_atomic = 0;
int atomic_supported = 0;
int use_push_options = 0;
@@ -435,6 +436,8 @@ int send_pack(struct send_pack_args *args,
const char *push_cert_nonce = NULL;
struct packet_reader reader;
+ git_config_get_bool("transfer.advertisesid", &advertise_sid);
+
/* Does the other end support the reporting? */
if (server_supports("report-status-v2"))
status_report = 2;
@@ -450,6 +453,8 @@ int send_pack(struct send_pack_args *args,
quiet_supported = 1;
if (server_supports("agent"))
agent_supported = 1;
+ if (!server_supports("session-id"))
+ advertise_sid = 0;
if (server_supports("no-thin"))
args->use_thin_pack = 0;
if (server_supports("atomic"))
@@ -506,6 +511,8 @@ int send_pack(struct send_pack_args *args,
strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name);
if (agent_supported)
strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized());
+ if (advertise_sid)
+ strbuf_addf(&cap_buf, " session-id=%s", trace2_session_id());
/*
* NEEDSWORK: why does delete-refs have to be so specific to