Skip to content

Commit c723a76

Browse files
j6tgitster
authored andcommitted
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 704a314 (Use prerequisite tags to skip tests that depend on symbolic links, 2009-03-04). Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 889c6f0 commit c723a76

File tree

1 file changed

+10
-29
lines changed

1 file changed

+10
-29
lines changed

t/t0000-basic.sh

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -367,33 +367,14 @@ test_expect_success 'validate object ID of a known tree' '
367367

368368
# Various types of objects
369369

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-
386370
test_expect_success 'adding various types of objects with git update-index --add' '
387371
mkdir path2 path3 path3/subp3 &&
388372
paths="path0 path2/file2 path3/file3 path3/subp3/file3" &&
389373
(
390374
for p in $paths
391375
do
392376
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
397378
done
398379
) &&
399380
find path* ! -type d -print | xargs git update-index --add
@@ -405,7 +386,7 @@ test_expect_success 'showing stage with git ls-files --stage' '
405386
'
406387

407388
test_expect_success 'validate git ls-files output for a known tree' '
408-
$expectfilter >expected <<-\EOF &&
389+
cat >expected <<-\EOF &&
409390
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
410391
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
411392
100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
@@ -423,14 +404,14 @@ test_expect_success 'writing tree out with git write-tree' '
423404
'
424405

425406
test_expect_success 'validate object ID for a known tree' '
426-
test "$tree" = "$expectedtree"
407+
test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b
427408
'
428409

429410
test_expect_success 'showing tree with git ls-tree' '
430411
git ls-tree $tree >current
431412
'
432413

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' '
434415
cat >expected <<-\EOF &&
435416
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
436417
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
@@ -447,7 +428,7 @@ test_expect_success 'showing tree with git ls-tree -r' '
447428
'
448429

449430
test_expect_success 'git ls-tree -r output for a known tree' '
450-
$expectfilter >expected <<-\EOF &&
431+
cat >expected <<-\EOF &&
451432
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
452433
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
453434
100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
@@ -465,7 +446,7 @@ test_expect_success 'showing tree with git ls-tree -r -t' '
465446
git ls-tree -r -t $tree >current
466447
'
467448

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' '
469450
cat >expected <<-\EOF &&
470451
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
471452
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
@@ -487,15 +468,15 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '
487468
'
488469

489470
test_expect_success 'validate object ID for a known tree' '
490-
test "$ptree" = "$expectedptree1"
471+
test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3
491472
'
492473

493474
test_expect_success 'writing partial tree out with git write-tree --prefix' '
494475
ptree=$(git write-tree --prefix=path3/subp3)
495476
'
496477

497478
test_expect_success 'validate object ID for a known tree' '
498-
test "$ptree" = "$expectedptree2"
479+
test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2
499480
'
500481

501482
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'
529510
'
530511

531512
test_expect_success 'validate git diff-files output for a know cache/work tree state' '
532-
$expectfilter >expected <<\EOF &&
513+
cat >expected <<\EOF &&
533514
:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
534515
:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
535516
:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
@@ -553,7 +534,7 @@ test_expect_success 'no diff after checkout and git update-index --refresh' '
553534
'
554535

555536
################################################################
556-
P=$expectedtree
537+
P=087704a96baf1c2d1c869a8b084481e121c88b5b
557538

558539
test_expect_success 'git commit-tree records the correct tree in a commit' '
559540
commit0=$(echo NO | git commit-tree $P) &&

0 commit comments

Comments
 (0)