Merge branch 'master' into js/merge
[git/git.git] / t / t6024-recursive-merge.sh
1 #!/bin/sh
2
3 test_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
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
18
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
22
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
26
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
32
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
36
37 git checkout -b C
38 echo C > a1
39 GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1
40
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
46
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
52
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
58
59 test_expect_failure "combined merge conflicts" "git merge -m final G"
60
61 git ls-files --stage > out
62 cat > expect << EOF
63 100644 f70f10e4db19068f79bc43844b49f3eece45c4e8 1 a1
64 100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1
65 100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
66 EOF
67
68 test_expect_success "virtual trees were processed" "diff -u expect out"
69
70 test_done