git/t/t4122-apply-symlink-inside.sh
Ævar Arnfjörð Bjarmason 41be8ea223 tests: implicitly skip SYMLINKS tests using <prereq>
Change the tests that skipped due to unavailable SYMLINKS support to
use the three-arg prereq form of test_expect_success.

Now we get an indication of how many tests that need symlinks are
being skipped on platforms that don't support them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18 12:42:45 -07:00

56 lines
1 KiB
Bash
Executable file

#!/bin/sh
test_description='apply to deeper directory without getting fooled with symlink'
. ./test-lib.sh
lecho () {
for l_
do
echo "$l_"
done
}
test_expect_success SYMLINKS setup '
mkdir -p arch/i386/boot arch/x86_64 &&
lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
ln -s ../i386/boot arch/x86_64/boot &&
git add . &&
test_tick &&
git commit -m initial &&
git branch test &&
rm arch/x86_64/boot &&
mkdir arch/x86_64/boot &&
lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
git add . &&
test_tick &&
git commit -a -m second &&
git format-patch --binary -1 --stdout >test.patch
'
test_expect_success SYMLINKS apply '
git checkout test &&
git diff --exit-code test &&
git diff --exit-code --cached test &&
git apply --index test.patch
'
test_expect_success SYMLINKS 'check result' '
git diff --exit-code master &&
git diff --exit-code --cached master &&
test_tick &&
git commit -m replay &&
T1=$(git rev-parse "master^{tree}") &&
T2=$(git rev-parse "HEAD^{tree}") &&
test "z$T1" = "z$T2"
'
test_done