t0000: use test_ln_s_add to remove SYMLINKS prerequisite
t0000-basic hard-codes many object IDs. To cater to file systems that do not support symbolic links, different IDs are used depending on the SYMLINKS prerequisite. But we can observe the symbolic links are only needed to generate index entries. Use test_ln_s_add to generate the index entries and get rid of explicit SYMLINKS checks. This undoes the special casing introduced in this test by 704a3143 (Use prerequisite tags to skip tests that depend on symbolic links, 2009-03-04). Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Jun 7, 2013 at 22:53 UTC
c723a76d4da632f8fbb8e687cea751f6d16b4cb0
1 file changed
+10
-29
t/t0000-basic.sh
+10
-29
@@ -367,22 +367,6 @@ test_expect_success 'validate object ID of a known tree' '
367
368
# Various types of objects
369
370
-# Some filesystems do not support symblic links; on such systems
371
-# some expected values are different
372
-if test_have_prereq SYMLINKS
373
-then
374
- expectfilter=cat
375
- expectedtree=087704a96baf1c2d1c869a8b084481e121c88b5b
376
- expectedptree1=21ae8269cacbe57ae09138dcc3a2887f904d02b3
377
- expectedptree2=3c5e5399f3a333eddecce7a9b9465b63f65f51e2
378
-else
379
- expectfilter='grep -v sym'
380
- expectedtree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46
381
- expectedptree1=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325
382
- expectedptree2=ce580448f0148b985a513b693fdf7d802cacb44f
383
-fi
384
-
385
-
370
test_expect_success 'adding various types of objects with git update-index --add' '
371
mkdir path2 path3 path3/subp3 &&
372
paths="path0 path2/file2 path3/file3 path3/subp3/file3" &&
@@ -390,10 +374,7 @@ test_expect_success 'adding various types of objects with git update-index --add
374
for p in $paths
375
do
376
echo "hello $p" >$p || exit 1
393
- if test_have_prereq SYMLINKS
394
- then
395
- ln -s "hello $p" ${p}sym || exit 1
396
- fi
377
+ test_ln_s_add "hello $p" ${p}sym || exit 1
378
done
379
) &&
380
find path* ! -type d -print | xargs git update-index --add
@@ -405,7 +386,7 @@ test_expect_success 'showing stage with git ls-files --stage' '
386
'
387
388
test_expect_success 'validate git ls-files output for a known tree' '
408
- $expectfilter >expected <<-\EOF &&
389
+ cat >expected <<-\EOF &&
390
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
391
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
392
100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
@@ -423,14 +404,14 @@ test_expect_success 'writing tree out with git write-tree' '
404
'
405
406
test_expect_success 'validate object ID for a known tree' '
426
- test "$tree" = "$expectedtree"
407
+ test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b
408
'
409
410
test_expect_success 'showing tree with git ls-tree' '
411
git ls-tree $tree >current
412
'
413
433
-test_expect_success SYMLINKS 'git ls-tree output for a known tree' '
414
+test_expect_success 'git ls-tree output for a known tree' '
415
cat >expected <<-\EOF &&
416
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
417
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
@@ -447,7 +428,7 @@ test_expect_success 'showing tree with git ls-tree -r' '
428
'
429
430
test_expect_success 'git ls-tree -r output for a known tree' '
450
- $expectfilter >expected <<-\EOF &&
431
+ cat >expected <<-\EOF &&
432
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
433
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
434
100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
@@ -465,7 +446,7 @@ test_expect_success 'showing tree with git ls-tree -r -t' '
446
git ls-tree -r -t $tree >current
447
'
448
468
-test_expect_success SYMLINKS 'git ls-tree -r output for a known tree' '
449
+test_expect_success 'git ls-tree -r output for a known tree' '
450
cat >expected <<-\EOF &&
451
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
452
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
@@ -487,7 +468,7 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '
468
'
469
470
test_expect_success 'validate object ID for a known tree' '
490
- test "$ptree" = "$expectedptree1"
471
+ test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3
472
'
473
474
test_expect_success 'writing partial tree out with git write-tree --prefix' '
@@ -495,7 +476,7 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '
476
'
477
478
test_expect_success 'validate object ID for a known tree' '
498
- test "$ptree" = "$expectedptree2"
479
+ test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2
480
'
481
482
test_expect_success 'put invalid objects into the index' '
@@ -529,7 +510,7 @@ test_expect_success 'git read-tree followed by write-tree should be idempotent'
510
'
511
512
test_expect_success 'validate git diff-files output for a know cache/work tree state' '
532
- $expectfilter >expected <<\EOF &&
513
+ cat >expected <<\EOF &&
514
:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
515
:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
516
:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
@@ -553,7 +534,7 @@ test_expect_success 'no diff after checkout and git update-index --refresh' '
534
'
535
536
################################################################
556
-P=$expectedtree
537
+P=087704a96baf1c2d1c869a8b084481e121c88b5b
538
539
test_expect_success 'git commit-tree records the correct tree in a commit' '
540
commit0=$(echo NO | git commit-tree $P) &&