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
This commit is contained in:
Junio C Hamano 2020-01-22 15:07:32 -08:00
commit 45f47ff01d
2 changed files with 13 additions and 1 deletions

View File

@ -665,6 +665,18 @@ test_expect_success 'fetch from namespaced repo respects namespaces' '
test_cmp expect actual
'
test_expect_success 'ls-remote with v2 http sends only one POST' '
test_when_finished "rm -f log" &&
git ls-remote "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" >expect &&
GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \
ls-remote "$HTTPD_URL/smart/http_parent" >actual &&
test_cmp expect actual &&
grep "Send header: POST" log >posts &&
test_line_count = 1 posts
'
test_expect_success 'push with http:// and a config of v2 does not request v2' '
test_when_finished "rm -f log" &&
# Till v2 for push is designed, make sure that if a client has

View File

@ -737,7 +737,7 @@ static int disconnect_git(struct transport *transport)
{
struct git_transport_data *data = transport->data;
if (data->conn) {
if (data->got_remote_heads)
if (data->got_remote_heads && !transport->stateless_rpc)
packet_flush(data->fd[1]);
close(data->fd[0]);
close(data->fd[1]);