clone: Supply the right commit hash to post-checkout when -b is used
[git/jnareb-git/bp-gitweb.git] / t / t4131-apply-fake-ancestor.sh
blob94373ca9a0c20a4465a8788eef3dd7596f6e6c2d
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 &&
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