Skip to contentSkip to conversation

Kill bashizm in t/t3200-branch.sh and t/t7201-co.sh.

PATCH In review Adam Golebiowski 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Kill bashizm in t/t3200-branch.sh and t/t7201-co.sh.

On systems with /bin/sh being different than /bin/bash, make test fails due to some bash-specific constructs. This patch makes it possible to run the test-suite systems with on /bin/sh pointing to /bin/ksh.

---
 t/t3200-branch.sh |    2 +-
 t/t7201-co.sh     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
t/t3200-branch.sh +1 -1
index cb5f7a4..e8ff82f 100755
@@ -200,7 +200,7 @@ test_expect_success \
 
 test_expect_success \
     'branch from non-branch HEAD w/--track causes failure' \
-    '!(git branch --track my10 HEAD^)'
+    '! git branch --track my10 HEAD^'
 
 # Keep this test last, as it changes the current branch
 cat >expect <<EOF
t/t7201-co.sh +1 -1
index 3111baa..51a9928 100755
@@ -335,6 +335,6 @@ test_expect_success \
     git checkout -b delete-me master &&
     rm .git/refs/heads/delete-me &&
     test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
-    !(git checkout --track -b track)'
+    ! git checkout --track -b track'
 
 test_done
Signature · 6 lines
1.5.4.5


-- 
 http://www.mysza.eu.org/ | Everybody needs someone sure, someone true,
   PLD Linux developer    | Everybody needs some solid rock, I know I do.
#1 lore raw

t/t3200-branch.sh test_expect_success \ · line 203

Quoted 2 lines · Adam Golebiowski
t/t3200-branch.sh +1 -1
-    '!(git branch --track my10 HEAD^)'
+    '! git branch --track my10 HEAD^'

These should probably be using the new test_must_fail instead of '!' anyway.

-Peff

#2 lore raw
In reply to Adam Golebiowski
Quoted 15 lines · Adam Golebiowski

On systems with /bin/sh being different than /bin/bash, make test fails due to some bash-specific constructs. This patch makes it possible to run the test-suite systems with on /bin/sh pointing to /bin/ksh.

---
 t/t3200-branch.sh |    2 +-
 t/t7201-co.sh     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
t/t3200-branch.sh +0 -0
index cb5f7a4..e8ff82f 100755

t/t3200-branch.sh test_expect_success \ · line 203

Quoted 5 lines
t/t3200-branch.sh +1 -1
@@ -200,7 +200,7 @@ test_expect_success \
 
 test_expect_success \
     'branch from non-branch HEAD w/--track causes failure' \
-    '!(git branch --track my10 HEAD^)'
+    '! git branch --track my10 HEAD^'

I do not think you need a subshell for this particular test, so your change would not be making anything worse, but I do not see a point.

It is a plain vanilla POSIX shell construct; "! ( compound_list )" is not a bash-ism at all.

http://www.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html#tag_02_10

t/t7201-co.sh test_expect_success \ · line 338

Quoted 10 lines
t/t7201-co.sh +1 -1
index 3111baa..51a9928 100755
@@ -335,6 +335,6 @@ test_expect_success \
     git checkout -b delete-me master &&
     rm .git/refs/heads/delete-me &&
     test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
-    !(git checkout --track -b track)'
+    ! git checkout --track -b track'

Same comments apply.

Having said that, as both of these tests are trying to make sure that the command fails gracefully (iow, say "failure" and refuse, instead of barfing and dumping core), they could probably use test_must_fail, like this:

     git checkout -b delete-me master &&
     rm .git/refs/heads/delete-me &&
     test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&

- !(git checkout --track -b track)'
+ test_must_fail git checkout --track -b track'