Skip to content

Commit 7281f36

Browse files
devzero2000gitster
authored andcommitted
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 <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0b30a3 commit 7281f36

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/t5403-post-checkout-hook.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test_expect_success 'post-checkout receives the right arguments with HEAD unchan
3939
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
4040
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
4141
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
42-
test $old = $new -a $flag = 1
42+
test $old = $new && test $flag = 1
4343
'
4444

4545
test_expect_success 'post-checkout runs as expected ' '
@@ -52,23 +52,23 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' '
5252
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
5353
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
5454
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
55-
test $old = $new -a $flag = 1
55+
test $old = $new && test $flag = 1
5656
'
5757

5858
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
5959
GIT_DIR=clone2/.git git checkout new2 &&
6060
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
6161
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
6262
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
63-
test $old != $new -a $flag = 1
63+
test $old != $new && test $flag = 1
6464
'
6565

6666
test_expect_success 'post-checkout receives the right args when not switching branches ' '
6767
GIT_DIR=clone2/.git git checkout master b &&
6868
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
6969
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
7070
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
71-
test $old = $new -a $flag = 0
71+
test $old = $new && test $flag = 0
7272
'
7373

7474
if test "$(git config --bool core.filemode)" = true; then

0 commit comments

Comments
 (0)