bundle tests: use test_cmp instead of grep
commit63766510a15f67cdd067ae0c0dcecb06fc6bfbf1
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 21 Jul 2021 23:53:29 +0000 (22 01:53 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Jul 2021 20:29:32 +0000 (22 13:29 -0700)
treeadc4114cbffce1756ec6454a3bb7a108031ae169
parent95cf6464ddd59c1bc52bf3d5e9630d5c1c6ab9e8
bundle tests: use test_cmp instead of grep

Change the bundle tests to fully compare the expected "git ls-remote"
or "git bundle list-heads" output, instead of merely grepping it.

This avoids subtle regressions in the tests. In
f62e0a39b6 (t5704 (bundle): add tests for bundle --stdin, 2010-04-19)
the "bundle --stdin <rev-list options>" test was added to make sure we
didn't include the tag.

But since the --stdin mode didn't work until 5bb0fd2cab (bundle:
arguments can be read from stdin, 2021-01-11) our grepping of
"master" (later "main") missed the important part of the test.

Namely that we should not include the "refs/tags/tag" tag in that
case. Since the test only grepped for "main" in the output we'd miss a
regression in that code.

So let's use test_cmp instead, and also in the other nearby tests
where it's easy.

This does make things a bit more verbose in the case of the test
that's checking the bundle header, since it's different under SHA1 and
SHA256. I think this makes test easier to follow.

I've got some WIP changes to extend the "git bundle" command to dump
parts of the header out, which are easier to understand if we test the
output explicitly like this.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5607-clone-bundle.sh