builtin-commit: add --date option
[git/vmiklos.git] / t / t4122-apply-symlink-inside.sh
blob0d3c1d5dd5c0f35f9cc44eab4fcba5ba2e36ddd7
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
12 lecho () {
13 for l_
15 echo "$l_"
16 done
19 test_expect_success setup '
21 mkdir -p arch/i386/boot arch/x86_64 &&
22 lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
23 ln -s ../i386/boot arch/x86_64/boot &&
24 git add . &&
25 test_tick &&
26 git commit -m initial &&
27 git branch test &&
29 rm arch/x86_64/boot &&
30 mkdir arch/x86_64/boot &&
31 lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile &&
32 git add . &&
33 test_tick &&
34 git commit -a -m second &&
36 git format-patch --binary -1 --stdout >test.patch
40 test_expect_success apply '
42 git checkout test &&
43 git diff --exit-code test &&
44 git diff --exit-code --cached test &&
45 git apply --index test.patch
49 test_expect_success 'check result' '
51 git diff --exit-code master &&
52 git diff --exit-code --cached master &&
53 test_tick &&
54 git commit -m replay &&
55 T1=$(git rev-parse "master^{tree}") &&
56 T2=$(git rev-parse "HEAD^{tree}") &&
57 test "z$T1" = "z$T2"
61 test_done