Code

Merge branch 'da/difftool-test'
[git.git] / t / t4131-apply-fake-ancestor.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2009 Stephen Boyd
4 #
6 test_description='git apply --build-fake-ancestor handling.'
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11         test_commit 1 &&
12         test_commit 2 &&
13         mkdir sub &&
14         test_commit 3 sub/3.t &&
15         test_commit 4
16 '
18 test_expect_success 'apply --build-fake-ancestor' '
19         git checkout 2 &&
20         echo "A" > 1.t &&
21         git diff > 1.patch &&
22         git reset --hard &&
23         git checkout 1 &&
24         git apply --build-fake-ancestor 1.ancestor 1.patch
25 '
27 test_expect_success 'apply --build-fake-ancestor in a subdirectory' '
28         git checkout 3 &&
29         echo "C" > sub/3.t &&
30         git diff > 3.patch &&
31         git reset --hard &&
32         git checkout 4 &&
33         (
34                 cd sub &&
35                 git apply --build-fake-ancestor 3.ancestor ../3.patch &&
36                 test -f 3.ancestor
37         ) &&
38         git apply --build-fake-ancestor 3.ancestor 3.patch &&
39         test_cmp sub/3.ancestor 3.ancestor
40 '
42 test_done