Skip to content

Commit bba5604

Browse files
j6tgitster
authored andcommitted
t3030: use test_ln_s_add to remove SYMLINKS prerequisite
The test cases include many corner-cases of merge-recursive's behavior, some of them involve type changes and symbolic links. All cases, including those that are protected by SYMLINKS check only whether the result of merge-recursive is correctly stored in the database and the index; the file system is not investigated. Use test_ln_s_add to enter a symbolic link in the index in the test setup and run the tests without the SYMLINKS prerequisite. Notice that one test that has the SYMLINKS protection removed is an expect_failure. There is a possibility that the test fails differently depending on whether SYMLINKS is present or not; but this is not the case presently. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c723a76 commit bba5604

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

t/t3030-merge-recursive.sh

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ test_expect_success 'setup 1' '
2525
git branch submod &&
2626
git branch copy &&
2727
git branch rename &&
28-
if test_have_prereq SYMLINKS
29-
then
30-
git branch rename-ln
31-
fi &&
28+
git branch rename-ln &&
3229
3330
echo hello >>a &&
3431
cp a d/e &&
@@ -260,16 +257,12 @@ test_expect_success 'setup 8' '
260257
git add e &&
261258
test_tick &&
262259
git commit -m "rename a->e" &&
263-
if test_have_prereq SYMLINKS
264-
then
265-
git checkout rename-ln &&
266-
git mv a e &&
267-
ln -s e a &&
268-
git add a e &&
269-
test_tick &&
270-
git commit -m "rename a->e, symlink a->e" &&
271-
oln=`printf e | git hash-object --stdin`
272-
fi
260+
git checkout rename-ln &&
261+
git mv a e &&
262+
test_ln_s_add e a &&
263+
test_tick &&
264+
git commit -m "rename a->e, symlink a->e" &&
265+
oln=`printf e | git hash-object --stdin`
273266
'
274267

275268
test_expect_success 'setup 9' '
@@ -569,28 +562,25 @@ test_expect_success 'merge-recursive copy vs. rename' '
569562
test_cmp expected actual
570563
'
571564

572-
if test_have_prereq SYMLINKS
573-
then
574-
test_expect_failure 'merge-recursive rename vs. rename/symlink' '
575-
576-
git checkout -f rename &&
577-
git merge rename-ln &&
578-
( git ls-tree -r HEAD ; git ls-files -s ) >actual &&
579-
(
580-
echo "120000 blob $oln a"
581-
echo "100644 blob $o0 b"
582-
echo "100644 blob $o0 c"
583-
echo "100644 blob $o0 d/e"
584-
echo "100644 blob $o0 e"
585-
echo "120000 $oln 0 a"
586-
echo "100644 $o0 0 b"
587-
echo "100644 $o0 0 c"
588-
echo "100644 $o0 0 d/e"
589-
echo "100644 $o0 0 e"
590-
) >expected &&
591-
test_cmp expected actual
592-
'
593-
fi
565+
test_expect_failure 'merge-recursive rename vs. rename/symlink' '
566+
567+
git checkout -f rename &&
568+
git merge rename-ln &&
569+
( git ls-tree -r HEAD ; git ls-files -s ) >actual &&
570+
(
571+
echo "120000 blob $oln a"
572+
echo "100644 blob $o0 b"
573+
echo "100644 blob $o0 c"
574+
echo "100644 blob $o0 d/e"
575+
echo "100644 blob $o0 e"
576+
echo "120000 $oln 0 a"
577+
echo "100644 $o0 0 b"
578+
echo "100644 $o0 0 c"
579+
echo "100644 $o0 0 d/e"
580+
echo "100644 $o0 0 e"
581+
) >expected &&
582+
test_cmp expected actual
583+
'
594584

595585

596586
test_done

0 commit comments

Comments
 (0)