Merge branch 'jc/branch-remove-remote'
[git/spearce.git] / t / t6024-recursive-merge.sh
blob964010e764a1f6340ae4a5cd300ef67cd6babfc4
1 #!/bin/sh
3 test_description='Test merge without common ancestors'
4 . ./test-lib.sh
6 # This scenario is based on a real-world repository of Shawn Pearce.
8 # 1 - A - D - F
9 # \ X /
10 # B X
11 # X \
12 # 2 - C - E - G
14 export GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
15 echo 1 > a1
16 git add a1
17 GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1
19 git checkout -b A master
20 echo A > a1
21 GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1
23 git checkout -b B master
24 echo B > a1
25 GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1
27 git checkout -b D A
28 git-rev-parse B > .git/MERGE_HEAD
29 echo D > a1
30 git update-index a1
31 GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D
33 git symbolic-ref HEAD refs/heads/other
34 echo 2 > a1
35 GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1
37 git checkout -b C
38 echo C > a1
39 GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1
41 git checkout -b E C
42 git-rev-parse B > .git/MERGE_HEAD
43 echo E > a1
44 git update-index a1
45 GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E
47 git checkout -b G E
48 git-rev-parse A > .git/MERGE_HEAD
49 echo G > a1
50 git update-index a1
51 GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G
53 git checkout -b F D
54 git-rev-parse C > .git/MERGE_HEAD
55 echo F > a1
56 git update-index a1
57 GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
59 test_expect_failure "combined merge conflicts" "git merge -m final G"
61 cat > expect << EOF
62 <<<<<<< HEAD/a1
64 =======
66 >>>>>>> 26f86b677eb03d4d956dbe108b29cb77061c1e73/a1
67 EOF
69 test_expect_success "result contains a conflict" "diff -u expect a1"
71 git ls-files --stage > out
72 cat > expect << EOF
73 100644 f16f906ab60483c100d1241dfc39868de9ec9fcb 1 a1
74 100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1
75 100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
76 EOF
78 test_expect_success "virtual trees were processed" "diff -u expect out"
80 test_done