]> git.ipfire.org Git - thirdparty/git.git/commit - t/t5329-pack-objects-cruft.sh
t5329: notice a failure within a loop
authorJunio C Hamano <gitster@pobox.com>
Mon, 22 Aug 2022 20:59:25 +0000 (13:59 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Aug 2022 21:24:17 +0000 (14:24 -0700)
commit9905e80b0fd9af3e6536d6201bf0198ffa48e8c9
treeb59e02fb2ffd83514ea8372a0bc5635db971d3b6
parent0e66bc1b215b1dd2b0f05c5777eb8ee2ae4e9523
t5329: notice a failure within a loop

We try to write "|| return 1" (or "|| exit 1" in a subshell) at the
end of a sequence of &&-chained command in a loop of our tests, so
that a failure of any step during the earlier iteration of the loop
can properly be caught.

There is one loop in this test script that is used to compute the
expected result, that will be later compared with an actual output
produced by the "test-tool pack-mtimes" command.  This particular
loop, however, is placed on the upstream side of a pipe, whose
non-zero exit code does not get noticed.

Emit a line that will never be produced by the "test-tool pack-mtimes"
to cause the later comparison to fail.  As we use test_cmp to compare
this "expected output" file with the "actual output", the "error
message" we are emitting into the expected output stream will stand
out and shown to the tester.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5329-pack-objects-cruft.sh