summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-05-08 14:25:12 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-05-08 14:25:12 -0700
commit282ce92448e25cfbf1b399c9d33eb290f2331814 (patch)
treee72d625d942ea8297f569fbb968464005c214439
parentMerge branch 'cb/t0000-use-the-configured-shell' (diff)
parentt/test_lib: avoid naked bash arrays in file_lineno (diff)
downloadtgif-282ce92448e25cfbf1b399c9d33eb290f2331814.tar.xz
Merge branch 'cb/test-bash-lineno-fix'
Recent change to show files and line numbers of a breakage during test (only available when running the tests with bash) were hurting other shells with syntax errors, which has been corrected. * cb/test-bash-lineno-fix: t/test_lib: avoid naked bash arrays in file_lineno
-rw-r--r--t/test-lib.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1b221951a8..baf94546da 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -677,14 +677,16 @@ die () {
file_lineno () {
test -z "$GIT_TEST_FRAMEWORK_SELFTEST" && test -n "$BASH" || return 0
- local i
- for i in ${!BASH_SOURCE[*]}
- do
- case $i,"${BASH_SOURCE[$i]##*/}" in
- 0,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:$LINENO: ${1+$1: }"; return;;
- *,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:${BASH_LINENO[$(($i-1))]}: ${1+$1: }"; return;;
- esac
- done
+ eval '
+ local i
+ for i in ${!BASH_SOURCE[*]}
+ do
+ case $i,"${BASH_SOURCE[$i]##*/}" in
+ 0,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:$LINENO: ${1+$1: }"; return;;
+ *,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:${BASH_LINENO[$(($i-1))]}: ${1+$1: }"; return;;
+ esac
+ done
+ '
}
GIT_EXIT_OK=