summaryrefslogtreecommitdiff
path: root/t/t9500-gitweb-standalone-no-errors.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-20 10:10:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-20 17:20:15 (GMT)
commita6a4a88af0b99fec688f66256a2c23a15e110c1f (patch)
treebfee73a8fc4decd7c1556a065b2202efadb0670b /t/t9500-gitweb-standalone-no-errors.sh
parent0a5e3c50de60c73782f1add9eb8d1e8dc8eabcb8 (diff)
downloadgit-a6a4a88af0b99fec688f66256a2c23a15e110c1f.zip
git-a6a4a88af0b99fec688f66256a2c23a15e110c1f.tar.gz
git-a6a4a88af0b99fec688f66256a2c23a15e110c1f.tar.bz2
t: fix &&-chaining issues around setup which might fail
Many tests have an initial setup step that might fail based on whether earlier tests in the script have succeeded or not. Using a trick like "|| true" breaks the &&-chain, missing earlier failures (and fooling --chain-lint). We can use test_might_fail in some cases, which is correct and makes the intent more obvious. We can also use test_unconfig for unsetting config (and which is more robust, as well). The case in t9500 is an oddball. It wants to run cmd1 _or_ cmd2, and does it like: cmd1 || cmd2 && other_stuff It's not wrong in this case, but it's a bad habit to get into, because it breaks the &&-chain if used anywhere except at the beginning of the test (and we use the correct solution here, putting it inside a block for precedence). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9500-gitweb-standalone-no-errors.sh')
-rwxr-xr-xt/t9500-gitweb-standalone-no-errors.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index f9f078e..e94b2f1 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -779,7 +779,10 @@ test_expect_success \
test_expect_success \
'unborn HEAD: "summary" page (with "heads" subview)' \
- 'git checkout orphan_branch || git checkout --orphan orphan_branch &&
+ '{
+ git checkout orphan_branch ||
+ git checkout --orphan orphan_branch
+ } &&
test_when_finished "git checkout master" &&
gitweb_run "p=.git;a=summary"'