704a3143d5
Many tests depend on that symbolic links work. This introduces a check that sets the prerequisite tag SYMLINKS if the file system supports symbolic links. Since so many tests have to check for this prerequisite, we do the check in test-lib.sh, so that we don't need to repeat the test in many scripts. To check for 'ln -s' failures, you can use a FAT partition on Linux: $ mkdosfs -C git-on-fat 1000000 $ sudo mount -o loop,uid=j6t,gid=users,shortname=winnt git-on-fat /mnt Clone git to /mnt and $ GIT_SKIP_TESTS='t0001.1[34] t0010 t1301 t403[34] t4129.[47] t5701.7 t7701.3 t9100 t9101.26 t9119 t9124.[67] t9200.10 t9600.6' \ make test (These additionally skipped tests depend on POSIX permissions that FAT on Linux does not provide.) Signed-off-by: Johannes Sixt <j6t@kdbg.org>
63 lines
1.1 KiB
Bash
Executable File
63 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='apply to deeper directory without getting fooled with symlink'
|
|
. ./test-lib.sh
|
|
|
|
if ! test_have_prereq SYMLINKS
|
|
then
|
|
say 'Symbolic links not supported, skipping tests.'
|
|
test_done
|
|
exit
|
|
fi
|
|
|
|
lecho () {
|
|
for l_
|
|
do
|
|
echo "$l_"
|
|
done
|
|
}
|
|
|
|
test_expect_success 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 apply '
|
|
|
|
git checkout test &&
|
|
git diff --exit-code test &&
|
|
git diff --exit-code --cached test &&
|
|
git apply --index test.patch
|
|
|
|
'
|
|
|
|
test_expect_success '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
|