Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2021-12-09 08:10:59 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-13 21:29:48 +0300
commitfe13adb17b7fcf0560139bb279d6d1274c84bec9 (patch)
tree2c91933832c875f5c9be7ea37f78b8851bb98a7c /t/t1020-subdirectory.sh
parentafb31ad95f035e5abff7c8a6b4a12195f41e857a (diff)
t1020: avoid aborting entire test script when one test fails
Although `exit 1` is the proper way to signal a test failure from within a subshell, its use outside any subshell should be avoided since it aborts the entire script rather than aborting only the failed test. Instead, a simple `return 1` is the proper idiom for signaling failure outside a subshell since it aborts only the test in question, not the entire script. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1020-subdirectory.sh')
-rwxr-xr-xt/t1020-subdirectory.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index c2df75e495..da19c06fb5 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -22,7 +22,7 @@ test_expect_success 'update-index and ls-files' '
git update-index --add one &&
case "$(git ls-files)" in
one) echo pass one ;;
- *) echo bad one; exit 1 ;;
+ *) echo bad one; return 1 ;;
esac &&
(
cd dir &&
@@ -34,7 +34,7 @@ test_expect_success 'update-index and ls-files' '
) &&
case "$(git ls-files)" in
dir/two"$LF"one) echo pass both ;;
- *) echo bad; exit 1 ;;
+ *) echo bad; return 1 ;;
esac
'
@@ -57,7 +57,7 @@ test_expect_success 'diff-files' '
echo d >>dir/two &&
case "$(git diff-files --name-only)" in
dir/two"$LF"one) echo pass top ;;
- *) echo bad top; exit 1 ;;
+ *) echo bad top; return 1 ;;
esac &&
# diff should not omit leading paths
(