t/t5403-post-checkout-hook.sh: avoid "test <cond> -a/-o <cond>"
The construct is error-prone; "test" being built-in in most modern shells, the reason to avoid "test <cond> && test <cond>" spawning one extra process by using a single "test <cond> -a <cond>" no longer exists. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto committed
Jun 6, 2014 at 07:55 UTC
7281f366120722c0aa6bac46936a153efcd74662
1 file changed
+4
-4
t/t5403-post-checkout-hook.sh
+4
-4
@@ -39,7 +39,7 @@ test_expect_success 'post-checkout receives the right arguments with HEAD unchan
39
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
40
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
41
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
42
- test $old = $new -a $flag = 1
42
+ test $old = $new && test $flag = 1
43
'
44
45
test_expect_success 'post-checkout runs as expected ' '
@@ -52,7 +52,7 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' '
52
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
53
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
54
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
55
- test $old = $new -a $flag = 1
55
+ test $old = $new && test $flag = 1
56
'
57
58
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
@@ -60,7 +60,7 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' '
60
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
61
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
62
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
63
- test $old != $new -a $flag = 1
63
+ test $old != $new && test $flag = 1
64
'
65
66
test_expect_success 'post-checkout receives the right args when not switching branches ' '
@@ -68,7 +68,7 @@ test_expect_success 'post-checkout receives the right args when not switching br
68
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
69
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
70
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
71
- test $old = $new -a $flag = 0
71
+ test $old = $new && test $flag = 0
72
'
73
74
if test "$(git config --bool core.filemode)" = true; then