37c9a9f254d626939ef28398ec15bec606a9c588
1 #!/bin/sh
3 test_description='apply to deeper directory without getting fooled with symlink'
4 . ./test-lib.sh
6 lecho () {
7 for l_
8 do
9 echo "$l_"
10 done
11 }
13 test_expect_success setup '
15 mkdir -p arch/i386/boot arch/x86_64 &&
16 lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
17 ln -s ../i386/boot arch/x86_64/boot &&
18 git add . &&
19 test_tick &&
20 git commit -m initial &&
21 git branch test &&
23 rm arch/x86_64/boot &&
24 mkdir arch/x86_64/boot &&
25 lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
26 git add . &&
27 test_tick &&
28 git commit -a -m second &&
30 git format-patch --binary -1 --stdout >test.patch
32 '
34 test_expect_success apply '
36 git checkout test &&
37 git reset --hard && #### checkout seems to be buggy
38 git diff --exit-code test &&
39 git diff --exit-code --cached test &&
40 git apply --index test.patch
42 '
44 test_expect_success 'check result' '
46 git diff --exit-code master &&
47 git diff --exit-code --cached master &&
48 test_tick &&
49 git commit -m replay &&
50 T1=$(git rev-parse "master^{tree}") &&
51 T2=$(git rev-parse "HEAD^{tree}") &&
52 test "z$T1" = "z$T2"
54 '
56 test_done