t5512: add v2 support for "ls-remote --symref" test
Commitb2f73b70b2
(t5512: compensate for v0 only sending HEAD symrefs, 2019-02-25) configured this test to always run with protocol v0, since the output is different for v2. But that means we are not getting any test coverage of the feature with v2 at all. We could obviously switch to using and expecting v2, but then that leaves v0 behind (and while we don't use it by default, it's still important for testing interoperability with older servers). Likewise, we could switch the expected output based on $GIT_TEST_PROTOCOL_VERSION, but hardly anybody runs the tests for v0 these days. Instead, let's explicitly run it for both protocol versions to make sure they're well behaved. This matches other similar tests added later in6a139cdd74
(ls-remote: pass heads/tags prefixes to transport, 2018-10-31), etc. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
13e67aa39b
commit
20272ee8cf
@ -244,22 +244,25 @@ test_expect_success 'protocol v2 supports hiderefs' '
|
||||
|
||||
test_expect_success 'ls-remote --symref' '
|
||||
git fetch origin &&
|
||||
echo "ref: refs/heads/main HEAD" >expect &&
|
||||
echo "ref: refs/heads/main HEAD" >expect.v2 &&
|
||||
generate_references \
|
||||
HEAD \
|
||||
refs/heads/main >>expect &&
|
||||
refs/heads/main >>expect.v2 &&
|
||||
echo "ref: refs/remotes/origin/main refs/remotes/origin/HEAD" >>expect.v2 &&
|
||||
oid=$(git rev-parse HEAD) &&
|
||||
echo "$oid refs/remotes/origin/HEAD" >>expect &&
|
||||
echo "$oid refs/remotes/origin/HEAD" >>expect.v2 &&
|
||||
generate_references \
|
||||
refs/remotes/origin/main \
|
||||
refs/tags/mark \
|
||||
refs/tags/mark1.1 \
|
||||
refs/tags/mark1.10 \
|
||||
refs/tags/mark1.2 >>expect &&
|
||||
# Protocol v2 supports sending symrefs for refs other than HEAD, so use
|
||||
# protocol v0 here.
|
||||
GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref >actual &&
|
||||
test_cmp expect actual
|
||||
refs/tags/mark1.2 >>expect.v2 &&
|
||||
# v0 does not show non-HEAD symrefs
|
||||
grep -v "ref: refs/remotes" <expect.v2 >expect.v0 &&
|
||||
git -c protocol.version=0 ls-remote --symref >actual.v0 &&
|
||||
test_cmp expect.v0 actual.v0 &&
|
||||
git -c protocol.version=2 ls-remote --symref >actual.v2 &&
|
||||
test_cmp expect.v2 actual.v2
|
||||
'
|
||||
|
||||
test_expect_success 'ls-remote with filtered symref (refname)' '
|
||||
|
Loading…
Reference in New Issue
Block a user