Merge pull request #285 from dscho/readme
[git/mingw/4msysgit.git] / t / t4131-apply-fake-ancestor.sh
blobb1361ce54693a07486f5837b0fe477f828b80a4e
1 #!/bin/sh
3 # Copyright (c) 2009 Stephen Boyd
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
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
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 &&
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
42 test_done