Skip to content

Commit 45f47ff

Browse files
committed
Merge branch 'jk/no-flush-upon-disconnecting-slrpc-transport'
Reduce unnecessary round-trip when running "ls-remote" over the stateless RPC mechanism. * jk/no-flush-upon-disconnecting-slrpc-transport: transport: don't flush when disconnecting stateless-rpc helper
2 parents 0f50154 + 4d8cab9 commit 45f47ff

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

t/t5702-protocol-v2.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,18 @@ test_expect_success 'fetch from namespaced repo respects namespaces' '
665665
test_cmp expect actual
666666
'
667667

668+
test_expect_success 'ls-remote with v2 http sends only one POST' '
669+
test_when_finished "rm -f log" &&
670+
671+
git ls-remote "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" >expect &&
672+
GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \
673+
ls-remote "$HTTPD_URL/smart/http_parent" >actual &&
674+
test_cmp expect actual &&
675+
676+
grep "Send header: POST" log >posts &&
677+
test_line_count = 1 posts
678+
'
679+
668680
test_expect_success 'push with http:// and a config of v2 does not request v2' '
669681
test_when_finished "rm -f log" &&
670682
# Till v2 for push is designed, make sure that if a client has

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ static int disconnect_git(struct transport *transport)
737737
{
738738
struct git_transport_data *data = transport->data;
739739
if (data->conn) {
740-
if (data->got_remote_heads)
740+
if (data->got_remote_heads && !transport->stateless_rpc)
741741
packet_flush(data->fd[1]);
742742
close(data->fd[0]);
743743
close(data->fd[1]);

0 commit comments

Comments
 (0)