]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: fix non-portable "${var:-"str"}" construct
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 28 Aug 2018 19:38:26 +0000 (19:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Aug 2018 17:34:10 +0000 (10:34 -0700)
On both AIX 7200-00-01-1543 and FreeBSD 11.2-RELEASE-p2 the
"${var:-"str"}" syntax means something different than what it does
under the bash or dash shells.

Both will consider the start of the new unescaped quotes to be a new
argument to test_expect_success, resulting in the following error:

    error: bug in the test script: 'git diff-tree initial # magic
    is (not' does not look like a prereq

Fix this by removing the redundant quotes. There's no need for them,
and the resulting code works under all the aforementioned shells. This
fixes a regression in c2f1d3989 ("t4013: test new output from diff
--abbrev --raw", 2017-12-03) first released with Git v2.16.0.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4013-diff-various.sh

index f8d853595b99bfff64521a502ee062b7e5f35e5f..73f7038253d6429f9d05c38f36c226107b5251ff 100755 (executable)
@@ -140,7 +140,7 @@ do
        expect="$TEST_DIRECTORY/t4013/diff.$test"
        actual="$pfx-diff.$test"
 
-       test_expect_success "git $cmd # magic is ${magic:-"(not used)"}" '
+       test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
                {
                        echo "$ git $cmd"
                        case "$magic" in