git-svn: fix ls-tree usage with dash-prefixed paths
[git/mjg.git] / t / t4122-apply-symlink-inside.sh
blob8aad20bfccc09310e2663f6bdab046520ae43fa9
1 #!/bin/sh
3 test_description='apply to deeper directory without getting fooled with symlink'
4 . ./test-lib.sh
6 if ! test_have_prereq SYMLINKS
7 then
8 say 'Symbolic links not supported, skipping tests.'
9 test_done
10 exit
13 lecho () {
14 for l_
16 echo "$l_"
17 done
20 test_expect_success setup '
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 &&
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 &&
37 git format-patch --binary -1 --stdout >test.patch
41 test_expect_success apply '
43 git checkout test &&
44 git diff --exit-code test &&
45 git diff --exit-code --cached test &&
46 git apply --index test.patch
50 test_expect_success 'check result' '
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"
62 test_done