t3412: use log|name-rev instead of log --graph
Replace all 'git log --graph' calls for history verification with the combination of 'git log ...| git name-rev' first introduced by a6c7a27 (rebase -i: correctly remember --root flag across --continue, 2009-01-26). This should be less susceptible to format changes than the --graph code. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Jan 30, 2009 at 23:47 UTC
2ea3c17189bf9ca459879129ca190792b5451f05
1 file changed
+39
-26
t/t3412-rebase-root.sh
+39
-26
@@ -10,6 +10,12 @@ Tests if git rebase --root --onto <newparent> can rebase the root commit.
10
GIT_EDITOR=:
11
export GIT_EDITOR
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
+
19
test_expect_success 'prepare repository' '
20
test_commit 1 A &&
21
test_commit 2 A &&
@@ -102,21 +108,25 @@ test_expect_success 'set up merge history' '
108
git merge side
109
'
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
124
EOF
125
126
test_expect_success 'rebase -i -p with merge' '
127
git checkout -b work6 other &&
128
git rebase -i -p --root --onto master &&
119
- git log --graph --topo-order --pretty=tformat:"%s" > rebased6 &&
129
+ log_with_names work6 > rebased6 &&
130
test_cmp expect-side rebased6
131
'
132
@@ -129,25 +139,29 @@ test_expect_success 'set up second root and merge' '
139
git merge third
140
'
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
159
EOF
160
161
test_expect_success 'rebase -i -p with two roots' '
162
git checkout -b work7 other &&
163
git rebase -i -p --root --onto master &&
150
- git log --graph --topo-order --pretty=tformat:"%s" > rebased7 &&
164
+ log_with_names work7 > rebased7 &&
165
test_cmp expect-third rebased7
166
'
167
@@ -263,8 +277,7 @@ test_expect_success 'fix the conflict' '
277
278
test_expect_success 'rebase -i -p --root with conflict (second part)' '
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 &&
281
test_cmp expect-conflict-p out
282
'
283