]> git.ipfire.org Git - thirdparty/git.git/blob - t/t4122-apply-symlink-inside.sh
Use prerequisite tags to skip tests that depend on symbolic links
[thirdparty/git.git] / t / t4122-apply-symlink-inside.sh
1 #!/bin/sh
2
3 test_description='apply to deeper directory without getting fooled with symlink'
4 . ./test-lib.sh
5
6 if ! test_have_prereq SYMLINKS
7 then
8 say 'Symbolic links not supported, skipping tests.'
9 test_done
10 exit
11 fi
12
13 lecho () {
14 for l_
15 do
16 echo "$l_"
17 done
18 }
19
20 test_expect_success setup '
21
22 mkdir -p arch/i386/boot arch/x86_64 &&
23 lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
24 ln -s ../i386/boot arch/x86_64/boot &&
25 git add . &&
26 test_tick &&
27 git commit -m initial &&
28 git branch test &&
29
30 rm arch/x86_64/boot &&
31 mkdir arch/x86_64/boot &&
32 lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
33 git add . &&
34 test_tick &&
35 git commit -a -m second &&
36
37 git format-patch --binary -1 --stdout >test.patch
38
39 '
40
41 test_expect_success apply '
42
43 git checkout test &&
44 git diff --exit-code test &&
45 git diff --exit-code --cached test &&
46 git apply --index test.patch
47
48 '
49
50 test_expect_success 'check result' '
51
52 git diff --exit-code master &&
53 git diff --exit-code --cached master &&
54 test_tick &&
55 git commit -m replay &&
56 T1=$(git rev-parse "master^{tree}") &&
57 T2=$(git rev-parse "HEAD^{tree}") &&
58 test "z$T1" = "z$T2"
59
60 '
61
62 test_done