]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t4216: use an '&&'-chain
authorTaylor Blau <me@ttaylorr.com>
Wed, 9 Sep 2020 15:22:50 +0000 (11:22 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Sep 2020 19:51:48 +0000 (12:51 -0700)
In a759bfa9ee (t4216: add end to end tests for git log with Bloom
filters, 2020-04-06), a 'rm' invocation was added without a
corresponding '&&' chain.

When 'trace.perf' already exists, everything works fine. However, the
function can be executed without 'trace.perf' on disk (eg., when the
subset of tests run is altered with '--run'), and so the bare 'rm'
complains about a missing file.

To remove some noise from the test log, invoke 'rm' with '-f', at which
point it is sensible to place the 'rm -f' in an '&&'-chain, which is
both (1) our usual style, and (2) avoids a broken chain in the future if
more commands are added at the beginning of the function.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4216-log-bloom.sh

index c9f9bdf1ba199b100cb505ac95abeae6f9c49a03..fe19f6a60c0097215dcb9d648622505a7853dd68 100755 (executable)
@@ -53,7 +53,7 @@ sane_unset GIT_TRACE2_PERF_BRIEF
 sane_unset GIT_TRACE2_CONFIG_PARAMS
 
 setup () {
-       rm "$TRASH_DIRECTORY/trace.perf"
+       rm -f "$TRASH_DIRECTORY/trace.perf" &&
        git -c core.commitGraph=false log --pretty="format:%s" $1 >log_wo_bloom &&
        GIT_TRACE2_PERF="$TRASH_DIRECTORY/trace.perf" git -c core.commitGraph=true log --pretty="format:%s" $1 >log_w_bloom
 }