@@ -6,13 +6,13 @@ git config core.autocrlf input
6
6
set -e
7
7
8
8
# 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
10
15
11
- export BASHLIB=" `
12
- find $PWD -type d |
13
- grep -E ' /(bin|lib)$' |
14
- xargs -n1 printf " %s:"
15
- ` "
16
16
export PATH=" $BASHLIB :$PATH "
17
17
source bash+ :std
18
18
@@ -64,7 +64,7 @@ subrepo-clone-bar-into-foo() {
64
64
65
65
add-new-files () {
66
66
local file
67
- for file in $* ; do
67
+ for file in " $@ " ; do
68
68
echo " new file $file " > " $file "
69
69
git add " $file "
70
70
done
@@ -73,15 +73,15 @@ add-new-files() {
73
73
74
74
remove-files () {
75
75
local file
76
- for file in $* ; do
76
+ for file in " $@ " ; do
77
77
git rm " $file "
78
78
done
79
79
git commit --quiet -m " Removed file: $file " & > /dev/null
80
80
}
81
81
82
82
modify-files () {
83
83
local file
84
- for file in $* ; do
84
+ for file in " $@ " ; do
85
85
echo ' a new line' >> " $file "
86
86
git add " $file "
87
87
done
@@ -90,7 +90,7 @@ modify-files() {
90
90
91
91
modify-files-ex () {
92
92
local file
93
- for file in $* ; do
93
+ for file in " $@ " ; do
94
94
echo " $file " >> " $file "
95
95
git add " $file "
96
96
done
@@ -102,49 +102,49 @@ test-exists() {
102
102
if [[ $f =~ ^! ]]; then
103
103
f=" ${f#! } "
104
104
if [[ $f =~ /$ ]]; then
105
- ok " ` [ ! -d " $f " ]` " \
105
+ ok " $( [ ! -d " $f " ]) " \
106
106
" Directory '$f ' does not exist"
107
107
else
108
- ok " ` [ ! -f " $f " ]` " \
108
+ ok " $( [ ! -f " $f " ]) " \
109
109
" File '$f ' does not exist"
110
110
fi
111
111
else
112
112
if [[ $f =~ /$ ]]; then
113
- ok " ` [ -d " $f " ]` " \
113
+ ok " $( [ -d " $f " ]) " \
114
114
" Directory '$f ' exists"
115
115
else
116
- ok " ` [ -f " $f " ]` " \
116
+ ok " $( [ -f " $f " ]) " \
117
117
" File '$f ' exists"
118
118
fi
119
119
fi
120
120
done
121
121
}
122
122
123
123
test-exists-in-index () {
124
- for f in $* ; do
124
+ for f in " $@ " ; do
125
125
if [[ " $f " =~ ^! ]]; then
126
126
f=" ${f#! } "
127
127
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 " ) " ] ) " \
129
129
" Directory '$f ' does not exist in index"
130
130
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 " ) " ] ) " \
132
132
" File '$f ' does not exist in index"
133
133
fi
134
134
else
135
135
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 " ) " ] ) " \
137
137
" Directory '$f ' exists in index"
138
138
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 " ) " ] ) " \
140
140
" File '$f ' exists in index"
141
141
fi
142
142
fi
143
143
done
144
144
}
145
145
146
146
test-gitrepo-comment-block () {
147
- is " $( grep -E ' ^;' $gitrepo ) " " \
147
+ is " $( grep -E ' ^;' " $gitrepo " ) " " \
148
148
; DO NOT EDIT (unless you know what you are doing)
149
149
;
150
150
; This subdirectory is a git \" subrepo\" , and this file is maintained by the
@@ -154,29 +154,29 @@ test-gitrepo-comment-block() {
154
154
}
155
155
156
156
test-gitrepo-field () {
157
- is " ` git config -f $gitrepo subrepo.$1 ` " \
157
+ is " $( git config -f " $gitrepo " subrepo." $1 " ) " \
158
158
" $2 " \
159
159
" .gitrepo $1 is correct"
160
160
}
161
161
162
162
test-commit-count () {
163
- is " ` cd $1 ; git rev-list --count $2 ` " \
163
+ is " $( cd " $1 " ; git rev-list --count " $2 " ) " \
164
164
" $3 " \
165
165
" commit count is correct"
166
166
}
167
167
168
168
save-original-state () {
169
- original_head_ref=" $( cd $1 ; cat .git/HEAD) "
169
+ original_head_ref=" $( cd " $1 " ; cat .git/HEAD) "
170
170
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) "
173
173
}
174
174
175
175
assert-original-state () {
176
- current_head_ref=" $( cd $1 ; cat .git/HEAD) "
176
+ current_head_ref=" $( cd " $1 " ; cat .git/HEAD) "
177
177
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) "
180
180
181
181
is " $current_head_ref " \
182
182
" $original_head_ref " \
0 commit comments