@@ -10,6 +10,12 @@ Tests if git rebase --root --onto <newparent> can rebase the root commit.
10
10
GIT_EDITOR=:
11
11
export GIT_EDITOR
12
12
13
+ log_with_names () {
14
+ git rev-list --topo-order --parents --pretty=" tformat:%s" HEAD |
15
+ git name-rev --stdin --name-only --refs=refs/heads/$1
16
+ }
17
+
18
+
13
19
test_expect_success ' prepare repository' '
14
20
test_commit 1 A &&
15
21
test_commit 2 A &&
@@ -102,21 +108,25 @@ test_expect_success 'set up merge history' '
102
108
git merge side
103
109
'
104
110
105
- sed ' s/#/ /g' > expect-side << 'EOF '
106
- * Merge branch 'side' into other
107
- |\##
108
- | * 5
109
- * | 4
110
- |/##
111
- * 3
112
- * 2
113
- * 1
111
+ cat > expect-side << 'EOF '
112
+ commit work6 work6~1 work6^2
113
+ Merge branch 'side' into other
114
+ commit work6^2 work6~2
115
+ 5
116
+ commit work6~1 work6~2
117
+ 4
118
+ commit work6~2 work6~3
119
+ 3
120
+ commit work6~3 work6~4
121
+ 2
122
+ commit work6~4
123
+ 1
114
124
EOF
115
125
116
126
test_expect_success ' rebase -i -p with merge' '
117
127
git checkout -b work6 other &&
118
128
git rebase -i -p --root --onto master &&
119
- git log --graph --topo-order --pretty=tformat:"%s" > rebased6 &&
129
+ log_with_names work6 > rebased6 &&
120
130
test_cmp expect-side rebased6
121
131
'
122
132
@@ -129,25 +139,29 @@ test_expect_success 'set up second root and merge' '
129
139
git merge third
130
140
'
131
141
132
- sed ' s/#/ /g' > expect-third << 'EOF '
133
- * Merge branch 'third' into other
134
- |\##
135
- | * 6
136
- * | Merge branch 'side' into other
137
- |\ \##
138
- | * | 5
139
- * | | 4
140
- |/ /##
141
- * | 3
142
- |/##
143
- * 2
144
- * 1
142
+ cat > expect-third << 'EOF '
143
+ commit work7 work7~1 work7^2
144
+ Merge branch 'third' into other
145
+ commit work7^2 work7~4
146
+ 6
147
+ commit work7~1 work7~2 work7~1^2
148
+ Merge branch 'side' into other
149
+ commit work7~1^2 work7~3
150
+ 5
151
+ commit work7~2 work7~3
152
+ 4
153
+ commit work7~3 work7~4
154
+ 3
155
+ commit work7~4 work7~5
156
+ 2
157
+ commit work7~5
158
+ 1
145
159
EOF
146
160
147
161
test_expect_success ' rebase -i -p with two roots' '
148
162
git checkout -b work7 other &&
149
163
git rebase -i -p --root --onto master &&
150
- git log --graph --topo-order --pretty=tformat:"%s" > rebased7 &&
164
+ log_with_names work7 > rebased7 &&
151
165
test_cmp expect-third rebased7
152
166
'
153
167
@@ -263,8 +277,7 @@ test_expect_success 'fix the conflict' '
263
277
264
278
test_expect_success ' rebase -i -p --root with conflict (second part)' '
265
279
git rebase --continue &&
266
- git rev-list --topo-order --parents --pretty="tformat:%s" HEAD |
267
- git name-rev --stdin --name-only --refs=refs/heads/conflict3 >out &&
280
+ log_with_names conflict3 >out &&
268
281
test_cmp expect-conflict-p out
269
282
'
270
283
0 commit comments