t5526: introduce test helper to assert on fetches
commitf3117dfdd1a0e586066bb8963b43324f5dee9f90
authorGlen Choo <chooglen@google.com>
Tue, 8 Mar 2022 00:14:24 +0000 (7 16:14 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Mar 2022 00:51:02 +0000 (7 16:51 -0800)
treee876b1fc8352a0137f9255fc38ac47f9286d5de1
parentdab1b7905d0b295f1acef9785bb2b9cbb0fdec84
t5526: introduce test helper to assert on fetches

Tests in t/t5526-fetch-submodules.sh are unnecessarily noisy:

* The tests have extra logic in order to reproduce the expected stderr
  literally, but not all of these details (e.g. the head of the
  remote-tracking branch before the fetch) are relevant to the test.

* The expect.err file is constructed by the add_upstream_commit() helper
  as input into test_cmp, but most tests fetch a different combination
  of repos from expect.err. This results in noisy tests that modify
  parts of that expect.err to generate the expected output.

To address both of these issues, introduce a verify_fetch_result()
helper to t/t5526-fetch-submodules.sh that asserts on the output of "git
fetch --recurse-submodules" and handles the ordering of expect.err.

As a result, the tests no longer construct expect.err manually. Tests
still consider the old head of the remote-tracking branch ("$head1"),
but that will be fixed in a later commit.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5526-fetch-submodules.sh