@@ -6,13 +6,13 @@ git config core.autocrlf input
66set -e
77
88# Set the GIT_SUBREPO_ROOT for testing.
9- source $PWD /.rc
9+ source " $PWD " /.rc
10+
11+ BASHLIB=" $(
12+ find " $PWD " / -type d -name bin -o -type d -name lib | tr ' \n' ' :'
13+ ) "
14+ export BASHLIB
1015
11- export BASHLIB=" `
12- find $PWD -type d |
13- grep -E ' /(bin|lib)$' |
14- xargs -n1 printf " %s:"
15- ` "
1616export PATH=" $BASHLIB :$PATH "
1717source bash+ :std
1818
@@ -64,7 +64,7 @@ subrepo-clone-bar-into-foo() {
6464
6565add-new-files () {
6666 local file
67- for file in $* ; do
67+ for file in " $@ " ; do
6868 echo " new file $file " > " $file "
6969 git add " $file "
7070 done
@@ -73,15 +73,15 @@ add-new-files() {
7373
7474remove-files () {
7575 local file
76- for file in $* ; do
76+ for file in " $@ " ; do
7777 git rm " $file "
7878 done
7979 git commit --quiet -m " Removed file: $file " & > /dev/null
8080}
8181
8282modify-files () {
8383 local file
84- for file in $* ; do
84+ for file in " $@ " ; do
8585 echo ' a new line' >> " $file "
8686 git add " $file "
8787 done
@@ -90,7 +90,7 @@ modify-files() {
9090
9191modify-files-ex () {
9292 local file
93- for file in $* ; do
93+ for file in " $@ " ; do
9494 echo " $file " >> " $file "
9595 git add " $file "
9696 done
@@ -102,49 +102,49 @@ test-exists() {
102102 if [[ $f =~ ^! ]]; then
103103 f=" ${f#! } "
104104 if [[ $f =~ /$ ]]; then
105- ok " ` [ ! -d " $f " ]` " \
105+ ok " $( [ ! -d " $f " ]) " \
106106 " Directory '$f ' does not exist"
107107 else
108- ok " ` [ ! -f " $f " ]` " \
108+ ok " $( [ ! -f " $f " ]) " \
109109 " File '$f ' does not exist"
110110 fi
111111 else
112112 if [[ $f =~ /$ ]]; then
113- ok " ` [ -d " $f " ]` " \
113+ ok " $( [ -d " $f " ]) " \
114114 " Directory '$f ' exists"
115115 else
116- ok " ` [ -f " $f " ]` " \
116+ ok " $( [ -f " $f " ]) " \
117117 " File '$f ' exists"
118118 fi
119119 fi
120120 done
121121}
122122
123123test-exists-in-index () {
124- for f in $* ; do
124+ for f in " $@ " ; do
125125 if [[ " $f " =~ ^! ]]; then
126126 f=" ${f#! } "
127127 if [[ " $f " =~ /$ ]]; then
128- ok " ` [ ! $( git ls-tree --full-tree --name-only -r HEAD " $f " ) ] ` " \
128+ ok " $( [ ! " $( git ls-tree --full-tree --name-only -r HEAD " $f " ) " ] ) " \
129129 " Directory '$f ' does not exist in index"
130130 else
131- ok " ` [ ! $( git ls-tree --full-tree --name-only -r HEAD " $f " ) ] ` " \
131+ ok " $( [ ! " $( git ls-tree --full-tree --name-only -r HEAD " $f " ) " ] ) " \
132132 " File '$f ' does not exist in index"
133133 fi
134134 else
135135 if [[ " $f " =~ /$ ]]; then
136- ok " ` [ $( git ls-tree --full-tree --name-only -r HEAD " $f " ) ] ` " \
136+ ok " $( [ " $( git ls-tree --full-tree --name-only -r HEAD " $f " ) " ] ) " \
137137 " Directory '$f ' exists in index"
138138 else
139- ok " ` [ $( git ls-tree --full-tree --name-only -r HEAD " $f " ) ] ` " \
139+ ok " $( [ " $( git ls-tree --full-tree --name-only -r HEAD " $f " ) " ] ) " \
140140 " File '$f ' exists in index"
141141 fi
142142 fi
143143 done
144144}
145145
146146test-gitrepo-comment-block () {
147- is " $( grep -E ' ^;' $gitrepo ) " " \
147+ is " $( grep -E ' ^;' " $gitrepo " ) " " \
148148; DO NOT EDIT (unless you know what you are doing)
149149;
150150; This subdirectory is a git \" subrepo\" , and this file is maintained by the
@@ -154,29 +154,29 @@ test-gitrepo-comment-block() {
154154}
155155
156156test-gitrepo-field () {
157- is " ` git config -f $gitrepo subrepo.$1 ` " \
157+ is " $( git config -f " $gitrepo " subrepo." $1 " ) " \
158158 " $2 " \
159159 " .gitrepo $1 is correct"
160160}
161161
162162test-commit-count () {
163- is " ` cd $1 ; git rev-list --count $2 ` " \
163+ is " $( cd " $1 " ; git rev-list --count " $2 " ) " \
164164 " $3 " \
165165 " commit count is correct"
166166}
167167
168168save-original-state () {
169- original_head_ref=" $( cd $1 ; cat .git/HEAD) "
169+ original_head_ref=" $( cd " $1 " ; cat .git/HEAD) "
170170 original_branch=" ${original_head_ref# ref: refs/ heads/ } "
171- original_head_commit=" $( cd $1 ; git rev-parse HEAD) "
172- original_gitrepo=" $( cd $1 ; cat $2 /.gitrepo) "
171+ original_head_commit=" $( cd " $1 " ; git rev-parse HEAD) "
172+ original_gitrepo=" $( cd " $1 " ; cat " $2 " /.gitrepo) "
173173}
174174
175175assert-original-state () {
176- current_head_ref=" $( cd $1 ; cat .git/HEAD) "
176+ current_head_ref=" $( cd " $1 " ; cat .git/HEAD) "
177177 current_branch=" ${current_head_ref# ref: refs/ heads/ } "
178- current_head_commit=" $( cd $1 ; git rev-parse HEAD) "
179- current_gitrepo=" $( cd $1 ; cat $2 /.gitrepo) "
178+ current_head_commit=" $( cd " $1 " ; git rev-parse HEAD) "
179+ current_gitrepo=" $( cd " $1 " ; cat " $2 " /.gitrepo) "
180180
181181 is " $current_head_ref " \
182182 " $original_head_ref " \
0 commit comments