Skip to content

Commit 8c48700

Browse files
steadmongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8295946 commit 8c48700

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

send-pack.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ int send_pack(struct send_pack_args *args,
424424
int use_sideband = 0;
425425
int quiet_supported = 0;
426426
int agent_supported = 0;
427+
int advertise_sid = 0;
427428
int use_atomic = 0;
428429
int atomic_supported = 0;
429430
int use_push_options = 0;
@@ -435,6 +436,8 @@ int send_pack(struct send_pack_args *args,
435436
const char *push_cert_nonce = NULL;
436437
struct packet_reader reader;
437438

439+
git_config_get_bool("transfer.advertisesid", &advertise_sid);
440+
438441
/* Does the other end support the reporting? */
439442
if (server_supports("report-status-v2"))
440443
status_report = 2;
@@ -450,6 +453,8 @@ int send_pack(struct send_pack_args *args,
450453
quiet_supported = 1;
451454
if (server_supports("agent"))
452455
agent_supported = 1;
456+
if (!server_supports("session-id"))
457+
advertise_sid = 0;
453458
if (server_supports("no-thin"))
454459
args->use_thin_pack = 0;
455460
if (server_supports("atomic"))
@@ -506,6 +511,8 @@ int send_pack(struct send_pack_args *args,
506511
strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name);
507512
if (agent_supported)
508513
strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized());
514+
if (advertise_sid)
515+
strbuf_addf(&cap_buf, " session-id=%s", trace2_session_id());
509516

510517
/*
511518
* NEEDSWORK: why does delete-refs have to be so specific to

0 commit comments

Comments
 (0)