@@ -393,7 +393,7 @@ cmd_add()
393
393
sed -e ' s|/$||' -e ' s|:*/*\.git$||' -e ' s|.*[/:]||g' )
394
394
fi
395
395
396
- if test -z " $repo " -o -z " $sm_path " ; then
396
+ if test -z " $repo " || test -z " $sm_path " ; then
397
397
usage
398
398
fi
399
399
@@ -450,7 +450,7 @@ Use -f if you really want to add it." >&2
450
450
# perhaps the path exists and is already a git repo, else clone it
451
451
if test -e " $sm_path "
452
452
then
453
- if test -d " $sm_path " /.git -o -f " $sm_path " /.git
453
+ if test -d " $sm_path " /.git || test -f " $sm_path " /.git
454
454
then
455
455
eval_gettextln " Adding existing repo at '\$ sm_path' to the index"
456
456
else
@@ -832,7 +832,7 @@ Maybe you want to use 'update --init'?")"
832
832
continue
833
833
fi
834
834
835
- if ! test -d " $sm_path " /.git -o -f " $sm_path " /.git
835
+ if ! test -d " $sm_path " /.git && ! test -f " $sm_path " /.git
836
836
then
837
837
module_clone " $sm_path " " $name " " $url " " $reference " " $depth " || exit
838
838
cloned_modules=" $cloned_modules ;$name "
@@ -857,11 +857,11 @@ Maybe you want to use 'update --init'?")"
857
857
die " $( eval_gettext " Unable to find current ${remote_name} /${branch} revision in submodule path '\$ sm_path'" ) "
858
858
fi
859
859
860
- if test " $subsha1 " ! = " $sha1 " -o -n " $force "
860
+ if test " $subsha1 " ! = " $sha1 " || test -n " $force "
861
861
then
862
862
subforce=$force
863
863
# If we don't already have a -f flag and the submodule has never been checked out
864
- if test -z " $subsha1 " -a -z " $force "
864
+ if test -z " $subsha1 " && test -z " $force "
865
865
then
866
866
subforce=" -f"
867
867
fi
@@ -1031,7 +1031,7 @@ cmd_summary() {
1031
1031
then
1032
1032
head=$rev
1033
1033
test $# = 0 || shift
1034
- elif test -z " $1 " -o " $1 " = " HEAD"
1034
+ elif test -z " $1 " || test " $1 " = " HEAD"
1035
1035
then
1036
1036
# before the first commit: compare with an empty tree
1037
1037
head=$( git hash-object -w -t tree --stdin < /dev/null)
@@ -1056,13 +1056,17 @@ cmd_summary() {
1056
1056
while read mod_src mod_dst sha1_src sha1_dst status sm_path
1057
1057
do
1058
1058
# Always show modules deleted or type-changed (blob<->module)
1059
- test $status = D -o $status = T && echo " $sm_path " && continue
1059
+ if test " $status " = D || test " $status " = T
1060
+ then
1061
+ echo " $sm_path "
1062
+ continue
1063
+ fi
1060
1064
# Respect the ignore setting for --for-status.
1061
1065
if test -n " $for_status "
1062
1066
then
1063
1067
name=$( module_name " $sm_path " )
1064
1068
ignore_config=$( get_submodule_config " $name " ignore none)
1065
- test $status ! = A -a $ignore_config = all && continue
1069
+ test $status ! = A && test $ignore_config = all && continue
1066
1070
fi
1067
1071
# Also show added or modified modules which are checked out
1068
1072
GIT_DIR=" $sm_path /.git" git-rev-parse --git-dir > /dev/null 2>&1 &&
@@ -1122,7 +1126,7 @@ cmd_summary() {
1122
1126
* )
1123
1127
errmsg=
1124
1128
total_commits=$(
1125
- if test $mod_src = 160000 -a $mod_dst = 160000
1129
+ if test $mod_src = 160000 && test $mod_dst = 160000
1126
1130
then
1127
1131
range=" $sha1_src ...$sha1_dst "
1128
1132
elif test $mod_src = 160000
@@ -1159,7 +1163,7 @@ cmd_summary() {
1159
1163
# i.e. deleted or changed to blob
1160
1164
test $mod_dst = 160000 && echo " $errmsg "
1161
1165
else
1162
- if test $mod_src = 160000 -a $mod_dst = 160000
1166
+ if test $mod_src = 160000 && test $mod_dst = 160000
1163
1167
then
1164
1168
limit=
1165
1169
test $summary_limit -gt 0 && limit=" -$summary_limit "
@@ -1230,7 +1234,11 @@ cmd_status()
1230
1234
say " U$sha1 $displaypath "
1231
1235
continue
1232
1236
fi
1233
- if test -z " $url " || ! test -d " $sm_path " /.git -o -f " $sm_path " /.git
1237
+ if test -z " $url " ||
1238
+ {
1239
+ ! test -d " $sm_path " /.git &&
1240
+ ! test -f " $sm_path " /.git
1241
+ }
1234
1242
then
1235
1243
say " -$sha1 $displaypath "
1236
1244
continue ;
@@ -1399,7 +1407,7 @@ then
1399
1407
fi
1400
1408
1401
1409
# "--cached" is accepted only by "status" and "summary"
1402
- if test -n " $cached " && test " $command " ! = status -a " $command " ! = summary
1410
+ if test -n " $cached " && test " $command " ! = status && test " $command " ! = summary
1403
1411
then
1404
1412
usage
1405
1413
fi
0 commit comments