Merge branch 'jk/no-flush-upon-disconnecting-slrpc-transport' into maint

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-02-14 12:42:28 -08:00
Родитель ad9c895463 4d8cab95cc
Коммит 4a60c63a75
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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]);