t4205: drop top-level &&-chaining
authorJeff King <peff@peff.net>
Wed, 27 Jul 2016 18:55:02 +0000 (14:55 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Jul 2016 19:27:37 +0000 (12:27 -0700)
The test currently does something like:

do_one() &&
do_two() &&
test_expect_success ...

We generally avoid performing actions at the top-level of
the script (outside of a test_expect block) for two reasons:

1. The test harness is not checking and reporting if they
fail.

2. Their output is not handled correctly (not hidden by
default, nor shown with "-v").

Using &&-chains seems like it should help with (1), but it
doesn't. If either of the commands fails, we simply skip
running the follow-on test entirely, and the test harness
has no idea.

We can fix this by pushing that setup into its own block.
It _could_ go into the following test block, but since the
result in this case is used by multiple tests, it's more
clear to mark it explicitly as a distinct setup step.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4205-log-pretty-formats.sh
index d9f62425b052b4c136ce1f961d96b5063ce9a158..d6518fa66d8d93d3245da3715d1b21b020912f17 100755 (executable)
@@ -504,8 +504,10 @@ test_expect_success 'ISO and ISO-strict date formats display the same values' '
 '
 
 # get new digests (with no abbreviations)
-head1=$(git rev-parse --verify HEAD~0) &&
-head2=$(git rev-parse --verify HEAD~1) &&
+test_expect_success 'set up log decoration tests' '
+       head1=$(git rev-parse --verify HEAD~0) &&
+       head2=$(git rev-parse --verify HEAD~1)
+'
 
 test_expect_success 'log decoration properly follows tag chain' '
        git tag -a tag1 -m tag1 &&