1#!/bin/sh
2
3test_description='Test merge without common ancestors'
4. ./test-lib.sh
5
6# This scenario is based on a real-world repository of Shawn Pearce.
7
8# 1 - A - D - F
9# \ X /
10# B X
11# X \
12# 2 - C - E - G
13
14export GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
15echo 1 > a1
16git add a1
17GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1
18
19git checkout -b A master
20echo A > a1
21GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1
22
23git checkout -b B master
24echo B > a1
25GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1
26
27git checkout -b D A
28git-rev-parse B > .git/MERGE_HEAD
29echo D > a1
30git update-index a1
31GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D
32
33git symbolic-ref HEAD refs/heads/other
34echo 2 > a1
35GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1
36
37git checkout -b C
38echo C > a1
39GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1
40
41git checkout -b E C
42git-rev-parse B > .git/MERGE_HEAD
43echo E > a1
44git update-index a1
45GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E
46
47git checkout -b G E
48git-rev-parse A > .git/MERGE_HEAD
49echo G > a1
50git update-index a1
51GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G
52
53git checkout -b F D
54git-rev-parse C > .git/MERGE_HEAD
55echo F > a1
56git update-index a1
57GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
58
59test_expect_failure "combined merge conflicts" "git merge -m final G"
60
61git ls-files --stage > out
62cat > expect << EOF
63100644 f70f10e4db19068f79bc43844b49f3eece45c4e8 1 a1
64100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1
65100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
66EOF
67
68test_expect_success "virtual trees were processed" "diff -u expect out"
69
70test_done