t5551: handle v2 protocol in upload-pack service test
commit795d713e2c3f5da18f35958a7f1c81cc5b36e312
authorJeff King <peff@peff.net>
Thu, 23 Feb 2023 11:00:38 +0000 (23 06:00 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2023 21:01:15 +0000 (23 13:01 -0800)
treeca3cb48d651105f504b48078f912403e00fca97c
parent1c5a63818a4a421753b33d12fabcd316c229e61a
t5551: handle v2 protocol in upload-pack service test

We perform a clone and a fetch, and then check that we saw the expected
requests in Apache's access log. In the v2 protocol, there will be one
extra request to /git-upload-pack for each operation (since the initial
/info/refs probe is just used to upgrade the protocol).

As a result, this test is a noop unless the use of the v0 protocol is
forced. Which means that hardly anybody runs it, since you have to do so
manually.

Let's update it to handle v2 and run it always. We could do this by just
conditionally adding in the extra POST lines. But if we look at the
origin of the test in 7da4e2280c (test smart http fetch and push,
2009-10-30), the point is really just to make sure that the smart
git-upload-pack service was used at all. So rather than counting up the
individual requests, let's just make sure we saw each of the expected
types. This is a bit looser, but makes maintenance easier.

Since we're now matching with grep, we can also loosen the HTTP/1.1
match, which allows this test to pass when run with HTTP/2 via t5559.
That lets:

  GIT_TEST_PROTOCOL_VERSION=0 ./t5559-http-fetch-smart-http2.sh

run to completion, which previously failed (and of course it works if
you use v2, as well).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5551-http-fetch-smart.sh