summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-08-30 16:06:02 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-30 16:06:02 -0700
commitb81a85ecd82239386fc22f5f3c6914155e029ce8 (patch)
treeb0b40bcbf9ea3a5818d7c2a36cf01a0ac25c3d9e
parentMerge branch 'en/ort-becomes-the-default' (diff)
parentconnect, protocol: log negotiated protocol version (diff)
downloadtgif-b81a85ecd82239386fc22f5f3c6914155e029ce8.tar.xz
Merge branch 'js/log-protocol-version'
Debugging aid. * js/log-protocol-version: connect, protocol: log negotiated protocol version
-rw-r--r--connect.c2
-rw-r--r--protocol.c2
-rwxr-xr-xt/t5705-session-id-in-capabilities.sh11
3 files changed, 15 insertions, 0 deletions
diff --git a/connect.c b/connect.c
index 70b13389ba..aff13a270e 100644
--- a/connect.c
+++ b/connect.c
@@ -164,6 +164,8 @@ enum protocol_version discover_version(struct packet_reader *reader)
BUG("unknown protocol version");
}
+ trace2_data_intmax("transfer", NULL, "negotiated-version", version);
+
return version;
}
diff --git a/protocol.c b/protocol.c
index 052d7edbb9..c53f7df5be 100644
--- a/protocol.c
+++ b/protocol.c
@@ -73,6 +73,8 @@ enum protocol_version determine_protocol_version_server(void)
string_list_clear(&list, 0);
}
+ trace2_data_intmax("transfer", NULL, "negotiated-version", version);
+
return version;
}
diff --git a/t/t5705-session-id-in-capabilities.sh b/t/t5705-session-id-in-capabilities.sh
index f1d189d5bc..eb8c79aafd 100755
--- a/t/t5705-session-id-in-capabilities.sh
+++ b/t/t5705-session-id-in-capabilities.sh
@@ -73,6 +73,17 @@ do
grep \"key\":\"server-sid\" tr2-client-events &&
grep \"key\":\"client-sid\" tr2-server-events
'
+
+ test_expect_success "client & server log negotiated version (v${PROTO})" '
+ test_when_finished "rm -rf local tr2-client-events tr2-server-events" &&
+ cp -r "$LOCAL_PRISTINE" local &&
+ GIT_TRACE2_EVENT="$(pwd)/tr2-client-events" \
+ git -c protocol.version=$PROTO -C local fetch \
+ --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
+ origin &&
+ grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-client-events &&
+ grep \"key\":\"negotiated-version\",\"value\":\"$PROTO\" tr2-server-events
+ '
done
test_done