@@ -22,47 +22,17 @@ rewritten.
22
22
# where B, D and G touch the same file.
23
23
24
24
test_expect_success ' setup' '
25
- : > file1 &&
26
- git add file1 &&
27
- test_tick &&
28
- git commit -m A &&
29
- git tag A &&
30
- echo 1 > file1 &&
31
- test_tick &&
32
- git commit -m B file1 &&
33
- : > file2 &&
34
- git add file2 &&
35
- test_tick &&
36
- git commit -m C &&
37
- echo 2 > file1 &&
38
- test_tick &&
39
- git commit -m D file1 &&
40
- : > file3 &&
41
- git add file3 &&
42
- test_tick &&
43
- git commit -m E &&
44
- git tag E &&
45
- git checkout -b branch1 A &&
46
- : > file4 &&
47
- git add file4 &&
48
- test_tick &&
49
- git commit -m F &&
50
- git tag F &&
51
- echo 3 > file1 &&
52
- test_tick &&
53
- git commit -m G file1 &&
54
- git tag G &&
55
- : > file5 &&
56
- git add file5 &&
57
- test_tick &&
58
- git commit -m H &&
59
- git tag H &&
60
- git checkout -b branch2 F &&
61
- : > file6 &&
62
- git add file6 &&
63
- test_tick &&
64
- git commit -m I &&
65
- git tag I
25
+ test_commit A file1 &&
26
+ test_commit B file1 1 &&
27
+ test_commit C file2 &&
28
+ test_commit D file1 2 &&
29
+ test_commit E file3 &&
30
+ git checkout A &&
31
+ test_commit F file4 &&
32
+ test_commit G file1 3 &&
33
+ test_commit H file5 &&
34
+ git checkout F &&
35
+ test_commit I file6
66
36
'
67
37
68
38
# A - B - C - D - E
@@ -72,68 +42,44 @@ test_expect_success 'setup' '
72
42
# I -- G2 -- J -- K I -- K
73
43
# G2 = same changes as G
74
44
test_expect_success ' skip same-resolution merges with -p' '
75
- git checkout branch1 &&
45
+ git checkout H &&
76
46
! git merge E &&
77
- echo 23 > file1 &&
78
- git add file1 &&
79
- git commit -m L &&
80
- git checkout branch2 &&
81
- echo 3 > file1 &&
82
- git commit -a -m G2 &&
47
+ test_commit L file1 23 &&
48
+ git checkout I &&
49
+ test_commit G2 file1 3 &&
83
50
! git merge E &&
84
- echo 23 > file1 &&
85
- git add file1 &&
86
- git commit -m J &&
87
- echo file7 > file7 &&
88
- git add file7 &&
89
- git commit -m K &&
90
- GIT_EDITOR=: git rebase -i -p branch1 &&
91
- test $(git rev-parse branch2^^) = $(git rev-parse branch1) &&
51
+ test_commit J file1 23 &&
52
+ test_commit K file7 file7 &&
53
+ git rebase -i -p L &&
54
+ test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
92
55
test "23" = "$(cat file1)" &&
93
- test "" = "$(cat file6)" &&
94
- test "file7" = "$(cat file7)" &&
95
-
96
- git checkout branch1 &&
97
- git reset --hard H &&
98
- git checkout branch2 &&
99
- git reset --hard I
56
+ test "I" = "$(cat file6)" &&
57
+ test "file7" = "$(cat file7)"
100
58
'
101
59
102
60
# A - B - C - D - E
103
61
# \ \ \
104
- # F - G - H -- L \ --> L
105
- # \ | \
106
- # I -- G2 -- J -- K I -- G2 -- K
62
+ # F - G - H -- L2 \ --> L2
63
+ # \ | \
64
+ # I -- G3 --- J2 -- K2 I -- G3 -- K2
107
65
# G2 = different changes as G
108
66
test_expect_success ' keep different-resolution merges with -p' '
109
- git checkout branch1 &&
67
+ git checkout H &&
110
68
! git merge E &&
111
- echo 23 > file1 &&
112
- git add file1 &&
113
- git commit -m L &&
114
- git checkout branch2 &&
115
- echo 4 > file1 &&
116
- git commit -a -m G2 &&
69
+ test_commit L2 file1 23 &&
70
+ git checkout I &&
71
+ test_commit G3 file1 4 &&
117
72
! git merge E &&
118
- echo 24 > file1 &&
119
- git add file1 &&
120
- git commit -m J &&
121
- echo file7 > file7 &&
122
- git add file7 &&
123
- git commit -m K &&
124
- ! GIT_EDITOR=: git rebase -i -p branch1 &&
73
+ test_commit J2 file1 24 &&
74
+ test_commit K2 file7 file7 &&
75
+ test_must_fail git rebase -i -p L2 &&
125
76
echo 234 > file1 &&
126
77
git add file1 &&
127
- GIT_EDITOR=: git rebase --continue &&
128
- test $(git rev-parse branch2 ^^^) = $(git rev-parse branch1 ) &&
78
+ git rebase --continue &&
79
+ test $(git rev-parse HEAD ^^^) = $(git rev-parse L2 ) &&
129
80
test "234" = "$(cat file1)" &&
130
- test "" = "$(cat file6)" &&
131
- test "file7" = "$(cat file7)" &&
132
-
133
- git checkout branch1 &&
134
- git reset --hard H &&
135
- git checkout branch2 &&
136
- git reset --hard I
81
+ test "I" = "$(cat file6)" &&
82
+ test "file7" = "$(cat file7)"
137
83
'
138
84
139
85
test_done
0 commit comments