115
'test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904'
116
117
# Various types of objects
118
+# Some filesystems do not support symblic links; on such systems
119
+# some expected values are different
120
mkdir path2 path3 path3/subp3
119
-for p in path0 path2/file2 path3/file3 path3/subp3/file3
121
+paths='path0 path2/file2 path3/file3 path3/subp3/file3'
122
+for p in $paths
123
do
124
echo "hello $p" >$p
122
- ln -s "hello $p" ${p}sym
125
done
126
+if test_have_prereq SYMLINKS
127
+then
128
+ for p in $paths
129
+ do
130
+ ln -s "hello $p" ${p}sym
131
+ done
132
+ expectfilter=cat
133
+ expectedtree=087704a96baf1c2d1c869a8b084481e121c88b5b
134
+ expectedptree1=21ae8269cacbe57ae09138dcc3a2887f904d02b3
135
+ expectedptree2=3c5e5399f3a333eddecce7a9b9465b63f65f51e2
136
+else
137
+ expectfilter='grep -v sym'
138
+ expectedtree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46
139
+ expectedptree1=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325
140
+ expectedptree2=ce580448f0148b985a513b693fdf7d802cacb44f
141
+fi
142
+
143
test_expect_success \
144
'adding various types of objects with git update-index --add.' \
145
'find path* ! -type d -print | xargs git update-index --add'
149
'showing stage with git ls-files --stage' \
150
'git ls-files --stage >current'
151
133
-cat >expected <<\EOF
152
+$expectfilter >expected <<\EOF
153
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
154
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
155
100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
168
'tree=$(git write-tree)'
169
test_expect_success \
170
'validate object ID for a known tree.' \
152
- 'test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b'
171
+ 'test "$tree" = "$expectedtree"'
172
173
test_expect_success \
174
'showing tree with git ls-tree' \
179
040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
180
040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
181
EOF
163
-test_expect_success \
182
+test_expect_success SYMLINKS \
183
'git ls-tree output for a known tree.' \
184
'test_cmp expected current'
185
188
test_expect_success \
189
'showing tree with git ls-tree -r' \
190
'git ls-tree -r $tree >current'
172
-cat >expected <<\EOF
191
+$expectfilter >expected <<\EOF
192
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
193
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
194
100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
219
100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
220
120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
221
EOF
203
-test_expect_success \
222
+test_expect_success SYMLINKS \
223
'git ls-tree -r output for a known tree.' \
224
'test_cmp expected current'
225
228
'ptree=$(git write-tree --prefix=path3)'
229
test_expect_success \
230
'validate object ID for a known tree.' \
212
- 'test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3'
231
+ 'test "$ptree" = "$expectedptree1"'
232
233
test_expect_success \
234
'writing partial tree out with git write-tree --prefix.' \
235
'ptree=$(git write-tree --prefix=path3/subp3)'
236
test_expect_success \
237
'validate object ID for a known tree.' \
219
- 'test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2'
238
+ 'test "$ptree" = "$expectedptree2"'
239
240
cat >badobjects <<EOF
241
100644 blob 1000000000000000000000000000000000000000 dir/file1
268
newtree=$(git write-tree) &&
269
test "$newtree" = "$tree"'
270
252
-cat >expected <<\EOF
271
+$expectfilter >expected <<\EOF
272
:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
273
:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
274
:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
291
'git diff-files >current && cmp -s current /dev/null'
292
293
################################################################
275
-P=087704a96baf1c2d1c869a8b084481e121c88b5b
294
+P=$expectedtree
295
test_expect_success \
296
'git commit-tree records the correct tree in a commit.' \
297
'commit0=$(echo NO | git commit-tree $P) &&
327
test $numpath0 = 1
328
'
329
311
-test_expect_success 'absolute path works as expected' '
330
+test_expect_success SYMLINKS 'absolute path works as expected' '
331
mkdir first &&
332
ln -s ../.git first/.git &&
333
mkdir second &&