aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-25 12:23:56 -0700
committerJunio C Hamano <gitster@pobox.com>2014-06-25 12:23:56 -0700
commite56857246adbd3ab0ded490f300da8ef34374cbc (patch)
tree8ace41ac93994c2578e8f61abee57c5a2d748dde /t
parent5b9b715f94fde00f99e24938740e7e4a59dd2cc4 (diff)
parent6a0662304d85ffa288c960f688eb9704954ea8ee (diff)
downloadgit-e56857246adbd3ab0ded490f300da8ef34374cbc.tar.gz
git-e56857246adbd3ab0ded490f300da8ef34374cbc.tar.xz
Merge branch 'ep/avoid-test-a-o'
Update tests and scripts to avoid "test ... -a ...", which is often more error-prone than "test ... && test ...". Squashed misconversion fix-up into git-submodule.sh updates. * ep/avoid-test-a-o: git-submodule.sh: avoid "echo" path-like values git-submodule.sh: avoid "test <cond> -a/-o <cond>" t/test-lib-functions.sh: avoid "test <cond> -a/-o <cond>" t/t9814-git-p4-rename.sh: avoid "test <cond> -a/-o <cond>" t/t5538-push-shallow.sh: avoid "test <cond> -a/-o <cond>" t/t5403-post-checkout-hook.sh: avoid "test <cond> -a/-o <cond>" t/t5000-tar-tree.sh: avoid "test <cond> -a/-o <cond>" t/t4102-apply-rename.sh: avoid "test <cond> -a/-o <cond>" t/t0026-eol-config.sh: avoid "test <cond> -a/-o <cond>" t/t0025-crlf-auto.sh: avoid "test <cond> -a/-o <cond>" t/lib-httpd.sh: avoid "test <cond> -a/-o <cond>" git-rebase--interactive.sh: avoid "test <cond> -a/-o <cond>" git-mergetool.sh: avoid "test <cond> -a/-o <cond>" git-bisect.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-resolve.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-repack.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-merge.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-commit.sh: avoid "test <cond> -a/-o <cond>" contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>" check_bindir: avoid "test <cond> -a/-o <cond>"
Diffstat (limited to 't')
-rw-r--r--t/lib-httpd.sh2
-rwxr-xr-xt/t0025-crlf-auto.sh6
-rwxr-xr-xt/t0026-eol-config.sh8
-rwxr-xr-xt/t4102-apply-rename.sh2
-rwxr-xr-xt/t5000-tar-tree.sh2
-rwxr-xr-xt/t5403-post-checkout-hook.sh8
-rwxr-xr-xt/t9814-git-p4-rename.sh4
-rw-r--r--t/test-lib-functions.sh4
8 files changed, 18 insertions, 18 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 272fceef9..fd53b5718 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -142,7 +142,7 @@ prepare_httpd() {
HTTPD_URL_USER=$HTTPD_PROTO://user%40host@$HTTPD_DEST
HTTPD_URL_USER_PASS=$HTTPD_PROTO://user%40host:pass%40host@$HTTPD_DEST
- if test -n "$LIB_HTTPD_DAV" -o -n "$LIB_HTTPD_SVN"
+ if test -n "$LIB_HTTPD_DAV" || test -n "$LIB_HTTPD_SVN"
then
HTTPD_PARA="$HTTPD_PARA -DDAV"
diff --git a/t/t0025-crlf-auto.sh b/t/t0025-crlf-auto.sh
index b0e5694eb..28102de1a 100755
--- a/t/t0025-crlf-auto.sh
+++ b/t/t0025-crlf-auto.sh
@@ -36,7 +36,7 @@ test_expect_success 'default settings cause no changes' '
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
threediff=$(git diff three) &&
- test -z "$onediff" -a -z "$twodiff" -a -z "$threediff"
+ test -z "$onediff" && test -z "$twodiff" && test -z "$threediff"
'
test_expect_success 'crlf=true causes a CRLF file to be normalized' '
@@ -111,7 +111,7 @@ test_expect_success 'autocrlf=true does not normalize CRLF files' '
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
threediff=$(git diff three) &&
- test -z "$onediff" -a -z "$twodiff" -a -z "$threediff"
+ test -z "$onediff" && test -z "$twodiff" && test -z "$threediff"
'
test_expect_success 'text=auto, autocrlf=true _does_ normalize CRLF files' '
@@ -126,7 +126,7 @@ test_expect_success 'text=auto, autocrlf=true _does_ normalize CRLF files' '
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
threediff=$(git diff three) &&
- test -z "$onediff" -a -n "$twodiff" -a -z "$threediff"
+ test -z "$onediff" && test -n "$twodiff" && test -z "$threediff"
'
test_expect_success 'text=auto, autocrlf=true does not normalize binary files' '
diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh
index e1126aa7c..4807b0f01 100755
--- a/t/t0026-eol-config.sh
+++ b/t/t0026-eol-config.sh
@@ -36,7 +36,7 @@ test_expect_success 'eol=lf puts LFs in normalized file' '
! has_cr two &&
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
- test -z "$onediff" -a -z "$twodiff"
+ test -z "$onediff" && test -z "$twodiff"
'
test_expect_success 'eol=crlf puts CRLFs in normalized file' '
@@ -49,7 +49,7 @@ test_expect_success 'eol=crlf puts CRLFs in normalized file' '
! has_cr two &&
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
- test -z "$onediff" -a -z "$twodiff"
+ test -z "$onediff" && test -z "$twodiff"
'
test_expect_success 'autocrlf=true overrides eol=lf' '
@@ -63,7 +63,7 @@ test_expect_success 'autocrlf=true overrides eol=lf' '
has_cr two &&
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
- test -z "$onediff" -a -z "$twodiff"
+ test -z "$onediff" && test -z "$twodiff"
'
test_expect_success 'autocrlf=true overrides unset eol' '
@@ -77,7 +77,7 @@ test_expect_success 'autocrlf=true overrides unset eol' '
has_cr two &&
onediff=$(git diff one) &&
twodiff=$(git diff two) &&
- test -z "$onediff" -a -z "$twodiff"
+ test -z "$onediff" && test -z "$twodiff"
'
test_done
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index 49e2d6c34..fae305979 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -52,6 +52,6 @@ EOF
test_expect_success 'apply copy' \
'git apply --index --stat --summary --apply test-patch &&
- test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"'
+ test "$(cat bar)" = "This is bar" && test "$(cat foo)" = "This is foo"'
test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index bad84a36e..899c1c5bb 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -72,7 +72,7 @@ check_tar() {
for header in *.paxheader
do
data=${header%.paxheader}.data &&
- if test -h $data -o -e $data
+ if test -h $data || test -e $data
then
path=$(get_pax_header $header path) &&
if test -n "$path"
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index 1753ef2b9..fc898c9ea 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -39,7 +39,7 @@ test_expect_success 'post-checkout receives the right arguments with HEAD unchan
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
- test $old = $new -a $flag = 1
+ test $old = $new && test $flag = 1
'
test_expect_success 'post-checkout runs as expected ' '
@@ -52,7 +52,7 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' '
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
- test $old = $new -a $flag = 1
+ test $old = $new && test $flag = 1
'
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 ' '
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
- test $old != $new -a $flag = 1
+ test $old != $new && test $flag = 1
'
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
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
- test $old = $new -a $flag = 0
+ test $old = $new && test $flag = 0
'
if test "$(git config --bool core.filemode)" = true; then
diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index be802e0e1..1fc1f5f2a 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -177,7 +177,7 @@ test_expect_success 'detect copies' '
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
- test "$src" = file10 -o "$src" = file11 &&
+ test "$src" = file10 || test "$src" = file11 &&
git config git-p4.detectCopies $(($level + 2)) &&
git p4 submit &&
p4 filelog //depot/file12 &&
@@ -191,7 +191,7 @@ test_expect_success 'detect copies' '
level=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/C0*//") &&
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
- test "$src" = file10 -o "$src" = file11 -o "$src" = file12 &&
+ test "$src" = file10 || test "$src" = file11 || test "$src" = file12 &&
git config git-p4.detectCopies $(($level - 2)) &&
git p4 submit &&
p4 filelog //depot/file13 &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index c617c826d..0377d3e29 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -542,7 +542,7 @@ test_must_fail () {
if test $exit_code = 0; then
echo >&2 "test_must_fail: command succeeded: $*"
return 1
- elif test $exit_code -gt 129 -a $exit_code -le 192; then
+ elif test $exit_code -gt 129 && test $exit_code -le 192; then
echo >&2 "test_must_fail: died by signal: $*"
return 1
elif test $exit_code = 127; then
@@ -569,7 +569,7 @@ test_must_fail () {
test_might_fail () {
"$@"
exit_code=$?
- if test $exit_code -gt 129 -a $exit_code -le 192; then
+ if test $exit_code -gt 129 && test $exit_code -le 192; then
echo >&2 "test_might_fail: died by signal: $*"
return 1
elif test $exit_code = 127; then