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 <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Jun 7, 2013 at 22:53 UTC bba56042e7011a5555cb8b44a84e0d853fa43af5
1 file changed +26 -36
t/t3030-merge-recursive.sh
+26 -36
@@ -25,10 +25,7 @@ test_expect_success 'setup 1' '
25 git branch submod &&
26 git branch copy &&
27 git branch rename &&
28 - if test_have_prereq SYMLINKS
29 - then
30 - git branch rename-ln
31 - fi &&
28 + git branch rename-ln &&
29
30 echo hello >>a &&
31 cp a d/e &&
@@ -260,16 +257,12 @@ test_expect_success 'setup 8' '
257 git add e &&
258 test_tick &&
259 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`
266 '
267
268 test_expect_success 'setup 9' '
@@ -569,28 +562,25 @@ test_expect_success 'merge-recursive copy vs. rename' '
562 test_cmp expected actual
563 '
564
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 +'
584
585
586 test_done