Interested in helping open source friends on HP-UX?
[git/mjg.git] / t / t4122-apply-symlink-inside.sh
blob18146476636803938c1139fb749701e3625345ca
1 #!/bin/sh
3 test_description='apply to deeper directory without getting fooled with symlink'
4 . ./test-lib.sh
6 test_expect_success setup '
8 mkdir -p arch/i386/boot arch/x86_64 &&
9 test_write_lines 1 2 3 4 5 >arch/i386/boot/Makefile &&
10 test_ln_s_add ../i386/boot arch/x86_64/boot &&
11 git add . &&
12 test_tick &&
13 git commit -m initial &&
14 git branch test &&
16 rm arch/x86_64/boot &&
17 mkdir arch/x86_64/boot &&
18 test_write_lines 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
19 git add . &&
20 test_tick &&
21 git commit -a -m second &&
23 git format-patch --binary -1 --stdout >test.patch
27 test_expect_success apply '
29 git checkout test &&
30 git diff --exit-code test &&
31 git diff --exit-code --cached test &&
32 git apply --index test.patch
36 test_expect_success 'check result' '
38 git diff --exit-code master &&
39 git diff --exit-code --cached master &&
40 test_tick &&
41 git commit -m replay &&
42 T1=$(git rev-parse "master^{tree}") &&
43 T2=$(git rev-parse "HEAD^{tree}") &&
44 test "z$T1" = "z$T2"
48 test_done