]>
Commit | Line | Data |
---|---|---|
70819263 LK |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas, | |
4 | # Thomas Nguy, Khoi Nguyen | |
5 | # Grenoble INP Ensimag | |
6 | # | |
7 | ||
4f021b34 | 8 | test_description='git status advice' |
70819263 LK |
9 | |
10 | . ./test-lib.sh | |
11 | ||
12 | . "$TEST_DIRECTORY"/lib-rebase.sh | |
13 | ||
14 | set_fake_editor | |
15 | ||
16 | test_expect_success 'prepare for conflicts' ' | |
6a38ef2c | 17 | git config --global advice.statusuoption false && |
70819263 LK |
18 | test_commit init main.txt init && |
19 | git branch conflicts && | |
20 | test_commit on_master main.txt on_master && | |
21 | git checkout conflicts && | |
22 | test_commit on_conflicts main.txt on_conflicts | |
23 | ' | |
24 | ||
25 | ||
26 | test_expect_success 'status when conflicts unresolved' ' | |
27 | test_must_fail git merge master && | |
1c7969c9 MM |
28 | cat >expected <<\EOF && |
29 | On branch conflicts | |
30 | You have unmerged paths. | |
31 | (fix conflicts and run "git commit") | |
b0a61ab2 | 32 | (use "git merge --abort" to abort the merge) |
1c7969c9 MM |
33 | |
34 | Unmerged paths: | |
35 | (use "git add <file>..." to mark resolution) | |
c7cb333f | 36 | both modified: main.txt |
1c7969c9 MM |
37 | |
38 | no changes added to commit (use "git add" and/or "git commit -a") | |
39 | EOF | |
70819263 LK |
40 | git status --untracked-files=no >actual && |
41 | test_i18ncmp expected actual | |
42 | ' | |
43 | ||
44 | ||
45 | test_expect_success 'status when conflicts resolved before commit' ' | |
46 | git reset --hard conflicts && | |
47 | test_must_fail git merge master && | |
48 | echo one >main.txt && | |
49 | git add main.txt && | |
1c7969c9 MM |
50 | cat >expected <<\EOF && |
51 | On branch conflicts | |
52 | All conflicts fixed but you are still merging. | |
53 | (use "git commit" to conclude merge) | |
54 | ||
55 | Changes to be committed: | |
1c7969c9 MM |
56 | modified: main.txt |
57 | ||
58 | Untracked files not listed (use -u option to show untracked files) | |
59 | EOF | |
70819263 LK |
60 | git status --untracked-files=no >actual && |
61 | test_i18ncmp expected actual | |
62 | ' | |
63 | ||
64 | ||
65 | test_expect_success 'prepare for rebase conflicts' ' | |
66 | git reset --hard master && | |
67 | git checkout -b rebase_conflicts && | |
68 | test_commit one_rebase main.txt one && | |
69 | test_commit two_rebase main.txt two && | |
70 | test_commit three_rebase main.txt three | |
71 | ' | |
72 | ||
73 | ||
74 | test_expect_success 'status when rebase in progress before resolving conflicts' ' | |
75 | test_when_finished "git rebase --abort" && | |
0722c805 | 76 | ONTO=$(git rev-parse --short HEAD^^) && |
70819263 | 77 | test_must_fail git rebase HEAD^ --onto HEAD^^ && |
1c7969c9 MM |
78 | cat >expected <<EOF && |
79 | rebase in progress; onto $ONTO | |
80 | You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''. | |
81 | (fix conflicts and then run "git rebase --continue") | |
82 | (use "git rebase --skip" to skip this patch) | |
83 | (use "git rebase --abort" to check out the original branch) | |
84 | ||
85 | Unmerged paths: | |
80f537f7 | 86 | (use "git restore --staged <file>..." to unstage) |
1c7969c9 | 87 | (use "git add <file>..." to mark resolution) |
c7cb333f | 88 | both modified: main.txt |
1c7969c9 MM |
89 | |
90 | no changes added to commit (use "git add" and/or "git commit -a") | |
91 | EOF | |
70819263 LK |
92 | git status --untracked-files=no >actual && |
93 | test_i18ncmp expected actual | |
94 | ' | |
95 | ||
96 | ||
97 | test_expect_success 'status when rebase in progress before rebase --continue' ' | |
98 | git reset --hard rebase_conflicts && | |
99 | test_when_finished "git rebase --abort" && | |
0722c805 | 100 | ONTO=$(git rev-parse --short HEAD^^) && |
70819263 LK |
101 | test_must_fail git rebase HEAD^ --onto HEAD^^ && |
102 | echo three >main.txt && | |
103 | git add main.txt && | |
1c7969c9 MM |
104 | cat >expected <<EOF && |
105 | rebase in progress; onto $ONTO | |
106 | You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''. | |
107 | (all conflicts fixed: run "git rebase --continue") | |
108 | ||
109 | Changes to be committed: | |
80f537f7 | 110 | (use "git restore --staged <file>..." to unstage) |
1c7969c9 MM |
111 | modified: main.txt |
112 | ||
113 | Untracked files not listed (use -u option to show untracked files) | |
114 | EOF | |
70819263 LK |
115 | git status --untracked-files=no >actual && |
116 | test_i18ncmp expected actual | |
117 | ' | |
118 | ||
119 | ||
120 | test_expect_success 'prepare for rebase_i_conflicts' ' | |
121 | git reset --hard master && | |
122 | git checkout -b rebase_i_conflicts && | |
123 | test_commit one_unmerge main.txt one_unmerge && | |
124 | git branch rebase_i_conflicts_second && | |
125 | test_commit one_master main.txt one_master && | |
126 | git checkout rebase_i_conflicts_second && | |
127 | test_commit one_second main.txt one_second | |
128 | ' | |
129 | ||
130 | ||
131 | test_expect_success 'status during rebase -i when conflicts unresolved' ' | |
132 | test_when_finished "git rebase --abort" && | |
0722c805 | 133 | ONTO=$(git rev-parse --short rebase_i_conflicts) && |
84e6fb9d | 134 | LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) && |
70819263 | 135 | test_must_fail git rebase -i rebase_i_conflicts && |
1c7969c9 | 136 | cat >expected <<EOF && |
df25e947 | 137 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
138 | Last command done (1 command done): |
139 | pick $LAST_COMMIT one_second | |
140 | No commands remaining. | |
1c7969c9 MM |
141 | You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''. |
142 | (fix conflicts and then run "git rebase --continue") | |
143 | (use "git rebase --skip" to skip this patch) | |
144 | (use "git rebase --abort" to check out the original branch) | |
145 | ||
146 | Unmerged paths: | |
80f537f7 | 147 | (use "git restore --staged <file>..." to unstage) |
1c7969c9 | 148 | (use "git add <file>..." to mark resolution) |
c7cb333f | 149 | both modified: main.txt |
1c7969c9 MM |
150 | |
151 | no changes added to commit (use "git add" and/or "git commit -a") | |
152 | EOF | |
70819263 LK |
153 | git status --untracked-files=no >actual && |
154 | test_i18ncmp expected actual | |
155 | ' | |
156 | ||
157 | ||
158 | test_expect_success 'status during rebase -i after resolving conflicts' ' | |
159 | git reset --hard rebase_i_conflicts_second && | |
160 | test_when_finished "git rebase --abort" && | |
0722c805 | 161 | ONTO=$(git rev-parse --short rebase_i_conflicts) && |
84e6fb9d | 162 | LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) && |
70819263 LK |
163 | test_must_fail git rebase -i rebase_i_conflicts && |
164 | git add main.txt && | |
1c7969c9 | 165 | cat >expected <<EOF && |
df25e947 | 166 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
167 | Last command done (1 command done): |
168 | pick $LAST_COMMIT one_second | |
169 | No commands remaining. | |
1c7969c9 MM |
170 | You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''. |
171 | (all conflicts fixed: run "git rebase --continue") | |
172 | ||
173 | Changes to be committed: | |
80f537f7 | 174 | (use "git restore --staged <file>..." to unstage) |
1c7969c9 MM |
175 | modified: main.txt |
176 | ||
177 | Untracked files not listed (use -u option to show untracked files) | |
178 | EOF | |
70819263 LK |
179 | git status --untracked-files=no >actual && |
180 | test_i18ncmp expected actual | |
181 | ' | |
182 | ||
183 | ||
184 | test_expect_success 'status when rebasing -i in edit mode' ' | |
185 | git reset --hard master && | |
186 | git checkout -b rebase_i_edit && | |
187 | test_commit one_rebase_i main.txt one && | |
188 | test_commit two_rebase_i main.txt two && | |
84e6fb9d | 189 | COMMIT2=$(git rev-parse --short rebase_i_edit) && |
70819263 | 190 | test_commit three_rebase_i main.txt three && |
84e6fb9d | 191 | COMMIT3=$(git rev-parse --short rebase_i_edit) && |
70819263 LK |
192 | FAKE_LINES="1 edit 2" && |
193 | export FAKE_LINES && | |
194 | test_when_finished "git rebase --abort" && | |
0722c805 | 195 | ONTO=$(git rev-parse --short HEAD~2) && |
70819263 | 196 | git rebase -i HEAD~2 && |
1c7969c9 | 197 | cat >expected <<EOF && |
df25e947 | 198 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
199 | Last commands done (2 commands done): |
200 | pick $COMMIT2 two_rebase_i | |
201 | edit $COMMIT3 three_rebase_i | |
202 | No commands remaining. | |
1c7969c9 MM |
203 | You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' on '\''$ONTO'\''. |
204 | (use "git commit --amend" to amend the current commit) | |
205 | (use "git rebase --continue" once you are satisfied with your changes) | |
206 | ||
207 | nothing to commit (use -u to show untracked files) | |
208 | EOF | |
70819263 LK |
209 | git status --untracked-files=no >actual && |
210 | test_i18ncmp expected actual | |
211 | ' | |
212 | ||
213 | ||
2d1cceba LK |
214 | test_expect_success 'status when splitting a commit' ' |
215 | git reset --hard master && | |
216 | git checkout -b split_commit && | |
217 | test_commit one_split main.txt one && | |
218 | test_commit two_split main.txt two && | |
84e6fb9d | 219 | COMMIT2=$(git rev-parse --short split_commit) && |
2d1cceba | 220 | test_commit three_split main.txt three && |
84e6fb9d | 221 | COMMIT3=$(git rev-parse --short split_commit) && |
2d1cceba | 222 | test_commit four_split main.txt four && |
84e6fb9d | 223 | COMMIT4=$(git rev-parse --short split_commit) && |
2d1cceba LK |
224 | FAKE_LINES="1 edit 2 3" && |
225 | export FAKE_LINES && | |
226 | test_when_finished "git rebase --abort" && | |
0722c805 | 227 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
228 | git rebase -i HEAD~3 && |
229 | git reset HEAD^ && | |
1c7969c9 | 230 | cat >expected <<EOF && |
df25e947 | 231 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
232 | Last commands done (2 commands done): |
233 | pick $COMMIT2 two_split | |
234 | edit $COMMIT3 three_split | |
235 | Next command to do (1 remaining command): | |
236 | pick $COMMIT4 four_split | |
237 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
238 | You are currently splitting a commit while rebasing branch '\''split_commit'\'' on '\''$ONTO'\''. |
239 | (Once your working directory is clean, run "git rebase --continue") | |
240 | ||
241 | Changes not staged for commit: | |
242 | (use "git add <file>..." to update what will be committed) | |
80f537f7 | 243 | (use "git restore <file>..." to discard changes in working directory) |
1c7969c9 MM |
244 | modified: main.txt |
245 | ||
246 | no changes added to commit (use "git add" and/or "git commit -a") | |
247 | EOF | |
2d1cceba LK |
248 | git status --untracked-files=no >actual && |
249 | test_i18ncmp expected actual | |
250 | ' | |
251 | ||
252 | ||
253 | test_expect_success 'status after editing the last commit with --amend during a rebase -i' ' | |
254 | git reset --hard master && | |
255 | git checkout -b amend_last && | |
256 | test_commit one_amend main.txt one && | |
257 | test_commit two_amend main.txt two && | |
258 | test_commit three_amend main.txt three && | |
84e6fb9d | 259 | COMMIT3=$(git rev-parse --short amend_last) && |
2d1cceba | 260 | test_commit four_amend main.txt four && |
84e6fb9d | 261 | COMMIT4=$(git rev-parse --short amend_last) && |
2d1cceba LK |
262 | FAKE_LINES="1 2 edit 3" && |
263 | export FAKE_LINES && | |
264 | test_when_finished "git rebase --abort" && | |
0722c805 | 265 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
266 | git rebase -i HEAD~3 && |
267 | git commit --amend -m "foo" && | |
1c7969c9 | 268 | cat >expected <<EOF && |
df25e947 | 269 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
270 | Last commands done (3 commands done): |
271 | pick $COMMIT3 three_amend | |
272 | edit $COMMIT4 four_amend | |
273 | (see more in file .git/rebase-merge/done) | |
274 | No commands remaining. | |
1c7969c9 MM |
275 | You are currently editing a commit while rebasing branch '\''amend_last'\'' on '\''$ONTO'\''. |
276 | (use "git commit --amend" to amend the current commit) | |
277 | (use "git rebase --continue" once you are satisfied with your changes) | |
278 | ||
279 | nothing to commit (use -u to show untracked files) | |
280 | EOF | |
2d1cceba LK |
281 | git status --untracked-files=no >actual && |
282 | test_i18ncmp expected actual | |
283 | ' | |
284 | ||
285 | ||
286 | test_expect_success 'prepare for several edits' ' | |
287 | git reset --hard master && | |
288 | git checkout -b several_edits && | |
289 | test_commit one_edits main.txt one && | |
290 | test_commit two_edits main.txt two && | |
291 | test_commit three_edits main.txt three && | |
292 | test_commit four_edits main.txt four | |
293 | ' | |
294 | ||
295 | ||
296 | test_expect_success 'status: (continue first edit) second edit' ' | |
297 | FAKE_LINES="edit 1 edit 2 3" && | |
298 | export FAKE_LINES && | |
299 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
300 | COMMIT2=$(git rev-parse --short several_edits^^) && |
301 | COMMIT3=$(git rev-parse --short several_edits^) && | |
302 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 303 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
304 | git rebase -i HEAD~3 && |
305 | git rebase --continue && | |
1c7969c9 | 306 | cat >expected <<EOF && |
df25e947 | 307 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
308 | Last commands done (2 commands done): |
309 | edit $COMMIT2 two_edits | |
310 | edit $COMMIT3 three_edits | |
311 | Next command to do (1 remaining command): | |
312 | pick $COMMIT4 four_edits | |
313 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
314 | You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
315 | (use "git commit --amend" to amend the current commit) | |
316 | (use "git rebase --continue" once you are satisfied with your changes) | |
317 | ||
318 | nothing to commit (use -u to show untracked files) | |
319 | EOF | |
2d1cceba LK |
320 | git status --untracked-files=no >actual && |
321 | test_i18ncmp expected actual | |
322 | ' | |
323 | ||
324 | ||
325 | test_expect_success 'status: (continue first edit) second edit and split' ' | |
326 | git reset --hard several_edits && | |
327 | FAKE_LINES="edit 1 edit 2 3" && | |
328 | export FAKE_LINES && | |
329 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
330 | COMMIT2=$(git rev-parse --short several_edits^^) && |
331 | COMMIT3=$(git rev-parse --short several_edits^) && | |
332 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 333 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
334 | git rebase -i HEAD~3 && |
335 | git rebase --continue && | |
336 | git reset HEAD^ && | |
1c7969c9 | 337 | cat >expected <<EOF && |
df25e947 | 338 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
339 | Last commands done (2 commands done): |
340 | edit $COMMIT2 two_edits | |
341 | edit $COMMIT3 three_edits | |
342 | Next command to do (1 remaining command): | |
343 | pick $COMMIT4 four_edits | |
344 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
345 | You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
346 | (Once your working directory is clean, run "git rebase --continue") | |
347 | ||
348 | Changes not staged for commit: | |
349 | (use "git add <file>..." to update what will be committed) | |
80f537f7 | 350 | (use "git restore <file>..." to discard changes in working directory) |
1c7969c9 MM |
351 | modified: main.txt |
352 | ||
353 | no changes added to commit (use "git add" and/or "git commit -a") | |
354 | EOF | |
2d1cceba LK |
355 | git status --untracked-files=no >actual && |
356 | test_i18ncmp expected actual | |
357 | ' | |
358 | ||
359 | ||
360 | test_expect_success 'status: (continue first edit) second edit and amend' ' | |
361 | git reset --hard several_edits && | |
362 | FAKE_LINES="edit 1 edit 2 3" && | |
363 | export FAKE_LINES && | |
364 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
365 | COMMIT2=$(git rev-parse --short several_edits^^) && |
366 | COMMIT3=$(git rev-parse --short several_edits^) && | |
367 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 368 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
369 | git rebase -i HEAD~3 && |
370 | git rebase --continue && | |
371 | git commit --amend -m "foo" && | |
1c7969c9 | 372 | cat >expected <<EOF && |
df25e947 | 373 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
374 | Last commands done (2 commands done): |
375 | edit $COMMIT2 two_edits | |
376 | edit $COMMIT3 three_edits | |
377 | Next command to do (1 remaining command): | |
378 | pick $COMMIT4 four_edits | |
379 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
380 | You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
381 | (use "git commit --amend" to amend the current commit) | |
382 | (use "git rebase --continue" once you are satisfied with your changes) | |
383 | ||
384 | nothing to commit (use -u to show untracked files) | |
385 | EOF | |
2d1cceba LK |
386 | git status --untracked-files=no >actual && |
387 | test_i18ncmp expected actual | |
388 | ' | |
389 | ||
390 | ||
391 | test_expect_success 'status: (amend first edit) second edit' ' | |
392 | git reset --hard several_edits && | |
393 | FAKE_LINES="edit 1 edit 2 3" && | |
394 | export FAKE_LINES && | |
395 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
396 | COMMIT2=$(git rev-parse --short several_edits^^) && |
397 | COMMIT3=$(git rev-parse --short several_edits^) && | |
398 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 399 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
400 | git rebase -i HEAD~3 && |
401 | git commit --amend -m "a" && | |
402 | git rebase --continue && | |
1c7969c9 | 403 | cat >expected <<EOF && |
df25e947 | 404 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
405 | Last commands done (2 commands done): |
406 | edit $COMMIT2 two_edits | |
407 | edit $COMMIT3 three_edits | |
408 | Next command to do (1 remaining command): | |
409 | pick $COMMIT4 four_edits | |
410 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
411 | You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
412 | (use "git commit --amend" to amend the current commit) | |
413 | (use "git rebase --continue" once you are satisfied with your changes) | |
414 | ||
415 | nothing to commit (use -u to show untracked files) | |
416 | EOF | |
2d1cceba LK |
417 | git status --untracked-files=no >actual && |
418 | test_i18ncmp expected actual | |
419 | ' | |
420 | ||
421 | ||
422 | test_expect_success 'status: (amend first edit) second edit and split' ' | |
423 | git reset --hard several_edits && | |
424 | FAKE_LINES="edit 1 edit 2 3" && | |
425 | export FAKE_LINES && | |
426 | test_when_finished "git rebase --abort" && | |
0722c805 | 427 | ONTO=$(git rev-parse --short HEAD~3) && |
84e6fb9d GP |
428 | COMMIT2=$(git rev-parse --short several_edits^^) && |
429 | COMMIT3=$(git rev-parse --short several_edits^) && | |
430 | COMMIT4=$(git rev-parse --short several_edits) && | |
2d1cceba LK |
431 | git rebase -i HEAD~3 && |
432 | git commit --amend -m "b" && | |
433 | git rebase --continue && | |
434 | git reset HEAD^ && | |
1c7969c9 | 435 | cat >expected <<EOF && |
df25e947 | 436 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
437 | Last commands done (2 commands done): |
438 | edit $COMMIT2 two_edits | |
439 | edit $COMMIT3 three_edits | |
440 | Next command to do (1 remaining command): | |
441 | pick $COMMIT4 four_edits | |
442 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
443 | You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
444 | (Once your working directory is clean, run "git rebase --continue") | |
445 | ||
446 | Changes not staged for commit: | |
447 | (use "git add <file>..." to update what will be committed) | |
80f537f7 | 448 | (use "git restore <file>..." to discard changes in working directory) |
1c7969c9 MM |
449 | modified: main.txt |
450 | ||
451 | no changes added to commit (use "git add" and/or "git commit -a") | |
452 | EOF | |
2d1cceba LK |
453 | git status --untracked-files=no >actual && |
454 | test_i18ncmp expected actual | |
455 | ' | |
456 | ||
457 | ||
458 | test_expect_success 'status: (amend first edit) second edit and amend' ' | |
459 | git reset --hard several_edits && | |
460 | FAKE_LINES="edit 1 edit 2 3" && | |
461 | export FAKE_LINES && | |
462 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
463 | COMMIT2=$(git rev-parse --short several_edits^^) && |
464 | COMMIT3=$(git rev-parse --short several_edits^) && | |
465 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 466 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
467 | git rebase -i HEAD~3 && |
468 | git commit --amend -m "c" && | |
469 | git rebase --continue && | |
470 | git commit --amend -m "d" && | |
1c7969c9 | 471 | cat >expected <<EOF && |
df25e947 | 472 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
473 | Last commands done (2 commands done): |
474 | edit $COMMIT2 two_edits | |
475 | edit $COMMIT3 three_edits | |
476 | Next command to do (1 remaining command): | |
477 | pick $COMMIT4 four_edits | |
478 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
479 | You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
480 | (use "git commit --amend" to amend the current commit) | |
481 | (use "git rebase --continue" once you are satisfied with your changes) | |
482 | ||
483 | nothing to commit (use -u to show untracked files) | |
484 | EOF | |
2d1cceba LK |
485 | git status --untracked-files=no >actual && |
486 | test_i18ncmp expected actual | |
487 | ' | |
488 | ||
489 | ||
490 | test_expect_success 'status: (split first edit) second edit' ' | |
491 | git reset --hard several_edits && | |
492 | FAKE_LINES="edit 1 edit 2 3" && | |
493 | export FAKE_LINES && | |
494 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
495 | COMMIT2=$(git rev-parse --short several_edits^^) && |
496 | COMMIT3=$(git rev-parse --short several_edits^) && | |
497 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 498 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
499 | git rebase -i HEAD~3 && |
500 | git reset HEAD^ && | |
501 | git add main.txt && | |
502 | git commit -m "e" && | |
503 | git rebase --continue && | |
1c7969c9 | 504 | cat >expected <<EOF && |
df25e947 | 505 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
506 | Last commands done (2 commands done): |
507 | edit $COMMIT2 two_edits | |
508 | edit $COMMIT3 three_edits | |
509 | Next command to do (1 remaining command): | |
510 | pick $COMMIT4 four_edits | |
511 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
512 | You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
513 | (use "git commit --amend" to amend the current commit) | |
514 | (use "git rebase --continue" once you are satisfied with your changes) | |
515 | ||
516 | nothing to commit (use -u to show untracked files) | |
517 | EOF | |
2d1cceba LK |
518 | git status --untracked-files=no >actual && |
519 | test_i18ncmp expected actual | |
520 | ' | |
521 | ||
522 | ||
523 | test_expect_success 'status: (split first edit) second edit and split' ' | |
524 | git reset --hard several_edits && | |
525 | FAKE_LINES="edit 1 edit 2 3" && | |
526 | export FAKE_LINES && | |
527 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
528 | COMMIT2=$(git rev-parse --short several_edits^^) && |
529 | COMMIT3=$(git rev-parse --short several_edits^) && | |
530 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 531 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
532 | git rebase -i HEAD~3 && |
533 | git reset HEAD^ && | |
534 | git add main.txt && | |
535 | git commit --amend -m "f" && | |
536 | git rebase --continue && | |
537 | git reset HEAD^ && | |
1c7969c9 | 538 | cat >expected <<EOF && |
df25e947 | 539 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
540 | Last commands done (2 commands done): |
541 | edit $COMMIT2 two_edits | |
542 | edit $COMMIT3 three_edits | |
543 | Next command to do (1 remaining command): | |
544 | pick $COMMIT4 four_edits | |
545 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
546 | You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
547 | (Once your working directory is clean, run "git rebase --continue") | |
548 | ||
549 | Changes not staged for commit: | |
550 | (use "git add <file>..." to update what will be committed) | |
80f537f7 | 551 | (use "git restore <file>..." to discard changes in working directory) |
1c7969c9 MM |
552 | modified: main.txt |
553 | ||
554 | no changes added to commit (use "git add" and/or "git commit -a") | |
555 | EOF | |
2d1cceba LK |
556 | git status --untracked-files=no >actual && |
557 | test_i18ncmp expected actual | |
558 | ' | |
559 | ||
560 | ||
561 | test_expect_success 'status: (split first edit) second edit and amend' ' | |
562 | git reset --hard several_edits && | |
563 | FAKE_LINES="edit 1 edit 2 3" && | |
564 | export FAKE_LINES && | |
565 | test_when_finished "git rebase --abort" && | |
84e6fb9d GP |
566 | COMMIT2=$(git rev-parse --short several_edits^^) && |
567 | COMMIT3=$(git rev-parse --short several_edits^) && | |
568 | COMMIT4=$(git rev-parse --short several_edits) && | |
0722c805 | 569 | ONTO=$(git rev-parse --short HEAD~3) && |
2d1cceba LK |
570 | git rebase -i HEAD~3 && |
571 | git reset HEAD^ && | |
572 | git add main.txt && | |
573 | git commit --amend -m "g" && | |
574 | git rebase --continue && | |
575 | git commit --amend -m "h" && | |
1c7969c9 | 576 | cat >expected <<EOF && |
df25e947 | 577 | interactive rebase in progress; onto $ONTO |
84e6fb9d GP |
578 | Last commands done (2 commands done): |
579 | edit $COMMIT2 two_edits | |
580 | edit $COMMIT3 three_edits | |
581 | Next command to do (1 remaining command): | |
582 | pick $COMMIT4 four_edits | |
583 | (use "git rebase --edit-todo" to view and edit) | |
1c7969c9 MM |
584 | You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''. |
585 | (use "git commit --amend" to amend the current commit) | |
586 | (use "git rebase --continue" once you are satisfied with your changes) | |
587 | ||
588 | nothing to commit (use -u to show untracked files) | |
589 | EOF | |
2d1cceba LK |
590 | git status --untracked-files=no >actual && |
591 | test_i18ncmp expected actual | |
592 | ' | |
593 | ||
594 | ||
70819263 LK |
595 | test_expect_success 'prepare am_session' ' |
596 | git reset --hard master && | |
597 | git checkout -b am_session && | |
598 | test_commit one_am one.txt "one" && | |
599 | test_commit two_am two.txt "two" && | |
600 | test_commit three_am three.txt "three" | |
601 | ' | |
602 | ||
603 | ||
604 | test_expect_success 'status in an am session: file already exists' ' | |
605 | git checkout -b am_already_exists && | |
606 | test_when_finished "rm Maildir/* && git am --abort" && | |
607 | git format-patch -1 -oMaildir && | |
608 | test_must_fail git am Maildir/*.patch && | |
1c7969c9 MM |
609 | cat >expected <<\EOF && |
610 | On branch am_already_exists | |
611 | You are in the middle of an am session. | |
612 | (fix conflicts and then run "git am --continue") | |
613 | (use "git am --skip" to skip this patch) | |
614 | (use "git am --abort" to restore the original branch) | |
615 | ||
616 | nothing to commit (use -u to show untracked files) | |
617 | EOF | |
70819263 LK |
618 | git status --untracked-files=no >actual && |
619 | test_i18ncmp expected actual | |
620 | ' | |
621 | ||
622 | ||
623 | test_expect_success 'status in an am session: file does not exist' ' | |
624 | git reset --hard am_session && | |
625 | git checkout -b am_not_exists && | |
626 | git rm three.txt && | |
627 | git commit -m "delete three.txt" && | |
628 | test_when_finished "rm Maildir/* && git am --abort" && | |
629 | git format-patch -1 -oMaildir && | |
630 | test_must_fail git am Maildir/*.patch && | |
1c7969c9 MM |
631 | cat >expected <<\EOF && |
632 | On branch am_not_exists | |
633 | You are in the middle of an am session. | |
634 | (fix conflicts and then run "git am --continue") | |
635 | (use "git am --skip" to skip this patch) | |
636 | (use "git am --abort" to restore the original branch) | |
637 | ||
638 | nothing to commit (use -u to show untracked files) | |
639 | EOF | |
70819263 LK |
640 | git status --untracked-files=no >actual && |
641 | test_i18ncmp expected actual | |
642 | ' | |
643 | ||
644 | ||
645 | test_expect_success 'status in an am session: empty patch' ' | |
646 | git reset --hard am_session && | |
647 | git checkout -b am_empty && | |
648 | test_when_finished "rm Maildir/* && git am --abort" && | |
649 | git format-patch -3 -oMaildir && | |
650 | git rm one.txt two.txt three.txt && | |
651 | git commit -m "delete all am_empty" && | |
652 | echo error >Maildir/0002-two_am.patch && | |
653 | test_must_fail git am Maildir/*.patch && | |
1c7969c9 MM |
654 | cat >expected <<\EOF && |
655 | On branch am_empty | |
656 | You are in the middle of an am session. | |
657 | The current patch is empty. | |
658 | (use "git am --skip" to skip this patch) | |
659 | (use "git am --abort" to restore the original branch) | |
660 | ||
661 | nothing to commit (use -u to show untracked files) | |
662 | EOF | |
70819263 LK |
663 | git status --untracked-files=no >actual && |
664 | test_i18ncmp expected actual | |
665 | ' | |
666 | ||
667 | ||
668 | test_expect_success 'status when bisecting' ' | |
669 | git reset --hard master && | |
670 | git checkout -b bisect && | |
671 | test_commit one_bisect main.txt one && | |
672 | test_commit two_bisect main.txt two && | |
673 | test_commit three_bisect main.txt three && | |
674 | test_when_finished "git bisect reset" && | |
675 | git bisect start && | |
676 | git bisect bad && | |
677 | git bisect good one_bisect && | |
b397ea48 | 678 | TGT=$(git rev-parse --short two_bisect) && |
1c7969c9 MM |
679 | cat >expected <<EOF && |
680 | HEAD detached at $TGT | |
681 | You are currently bisecting, started from branch '\''bisect'\''. | |
682 | (use "git bisect reset" to get back to the original branch) | |
683 | ||
684 | nothing to commit (use -u to show untracked files) | |
685 | EOF | |
70819263 LK |
686 | git status --untracked-files=no >actual && |
687 | test_i18ncmp expected actual | |
688 | ' | |
689 | ||
690 | ||
691 | test_expect_success 'status when rebase conflicts with statushints disabled' ' | |
692 | git reset --hard master && | |
693 | git checkout -b statushints_disabled && | |
694 | test_when_finished "git config --local advice.statushints true" && | |
695 | git config --local advice.statushints false && | |
696 | test_commit one_statushints main.txt one && | |
697 | test_commit two_statushints main.txt two && | |
698 | test_commit three_statushints main.txt three && | |
699 | test_when_finished "git rebase --abort" && | |
0722c805 | 700 | ONTO=$(git rev-parse --short HEAD^^) && |
70819263 | 701 | test_must_fail git rebase HEAD^ --onto HEAD^^ && |
1c7969c9 MM |
702 | cat >expected <<EOF && |
703 | rebase in progress; onto $ONTO | |
704 | You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''. | |
705 | ||
706 | Unmerged paths: | |
c7cb333f | 707 | both modified: main.txt |
1c7969c9 MM |
708 | |
709 | no changes added to commit | |
710 | EOF | |
70819263 LK |
711 | git status --untracked-files=no >actual && |
712 | test_i18ncmp expected actual | |
713 | ' | |
714 | ||
715 | ||
716 | test_expect_success 'prepare for cherry-pick conflicts' ' | |
717 | git reset --hard master && | |
718 | git checkout -b cherry_branch && | |
719 | test_commit one_cherry main.txt one && | |
720 | test_commit two_cherries main.txt two && | |
721 | git checkout -b cherry_branch_second && | |
722 | test_commit second_cherry main.txt second && | |
723 | git checkout cherry_branch && | |
724 | test_commit three_cherries main.txt three | |
725 | ' | |
726 | ||
727 | ||
728 | test_expect_success 'status when cherry-picking before resolving conflicts' ' | |
729 | test_when_finished "git cherry-pick --abort" && | |
730 | test_must_fail git cherry-pick cherry_branch_second && | |
bffd8098 RT |
731 | TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) && |
732 | cat >expected <<EOF && | |
1c7969c9 | 733 | On branch cherry_branch |
bffd8098 | 734 | You are currently cherry-picking commit $TO_CHERRY_PICK. |
1c7969c9 MM |
735 | (fix conflicts and run "git cherry-pick --continue") |
736 | (use "git cherry-pick --abort" to cancel the cherry-pick operation) | |
737 | ||
738 | Unmerged paths: | |
739 | (use "git add <file>..." to mark resolution) | |
c7cb333f | 740 | both modified: main.txt |
1c7969c9 MM |
741 | |
742 | no changes added to commit (use "git add" and/or "git commit -a") | |
743 | EOF | |
70819263 LK |
744 | git status --untracked-files=no >actual && |
745 | test_i18ncmp expected actual | |
746 | ' | |
747 | ||
748 | ||
749 | test_expect_success 'status when cherry-picking after resolving conflicts' ' | |
750 | git reset --hard cherry_branch && | |
751 | test_when_finished "git cherry-pick --abort" && | |
752 | test_must_fail git cherry-pick cherry_branch_second && | |
bffd8098 | 753 | TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) && |
70819263 LK |
754 | echo end >main.txt && |
755 | git add main.txt && | |
bffd8098 | 756 | cat >expected <<EOF && |
1c7969c9 | 757 | On branch cherry_branch |
bffd8098 | 758 | You are currently cherry-picking commit $TO_CHERRY_PICK. |
1c7969c9 MM |
759 | (all conflicts fixed: run "git cherry-pick --continue") |
760 | (use "git cherry-pick --abort" to cancel the cherry-pick operation) | |
761 | ||
762 | Changes to be committed: | |
1c7969c9 MM |
763 | modified: main.txt |
764 | ||
765 | Untracked files not listed (use -u option to show untracked files) | |
766 | EOF | |
70819263 LK |
767 | git status --untracked-files=no >actual && |
768 | test_i18ncmp expected actual | |
769 | ' | |
770 | ||
4a72486d PW |
771 | test_expect_success 'status when cherry-picking after committing conflict resolution' ' |
772 | git reset --hard cherry_branch && | |
773 | test_when_finished "git cherry-pick --abort" && | |
774 | test_must_fail git cherry-pick cherry_branch_second one_cherry && | |
775 | echo end >main.txt && | |
776 | git commit -a && | |
777 | cat >expected <<EOF && | |
778 | On branch cherry_branch | |
779 | Cherry-pick currently in progress. | |
780 | (run "git cherry-pick --continue" to continue) | |
781 | (use "git cherry-pick --abort" to cancel the cherry-pick operation) | |
782 | ||
783 | nothing to commit (use -u to show untracked files) | |
784 | EOF | |
785 | git status --untracked-files=no >actual && | |
786 | test_i18ncmp expected actual | |
787 | ' | |
788 | ||
ed5b1ca1 PW |
789 | test_expect_success 'status shows cherry-pick with invalid oid' ' |
790 | mkdir .git/sequencer && | |
791 | test_write_lines "pick invalid-oid" >.git/sequencer/todo && | |
792 | git status --untracked-files=no >actual 2>err && | |
793 | git cherry-pick --quit && | |
794 | test_must_be_empty err && | |
795 | test_i18ncmp expected actual | |
796 | ' | |
797 | ||
798 | test_expect_success 'status does not show error if .git/sequencer is a file' ' | |
799 | test_when_finished "rm .git/sequencer" && | |
800 | test_write_lines hello >.git/sequencer && | |
801 | git status --untracked-files=no 2>err && | |
802 | test_must_be_empty err | |
803 | ' | |
804 | ||
46ab7d46 | 805 | test_expect_success 'status showing detached at and from a tag' ' |
b397ea48 NTND |
806 | test_commit atag tagging && |
807 | git checkout atag && | |
59c22205 | 808 | cat >expected <<\EOF && |
1c7969c9 MM |
809 | HEAD detached at atag |
810 | nothing to commit (use -u to show untracked files) | |
811 | EOF | |
b397ea48 | 812 | git status --untracked-files=no >actual && |
46ab7d46 JH |
813 | test_i18ncmp expected actual && |
814 | ||
815 | git reset --hard HEAD^ && | |
59c22205 | 816 | cat >expected <<\EOF && |
1c7969c9 MM |
817 | HEAD detached from atag |
818 | nothing to commit (use -u to show untracked files) | |
819 | EOF | |
46ab7d46 | 820 | git status --untracked-files=no >actual && |
b397ea48 NTND |
821 | test_i18ncmp expected actual |
822 | ' | |
70819263 | 823 | |
db4ef449 MM |
824 | test_expect_success 'status while reverting commit (conflicts)' ' |
825 | git checkout master && | |
826 | echo before >to-revert.txt && | |
827 | test_commit before to-revert.txt && | |
828 | echo old >to-revert.txt && | |
829 | test_commit old to-revert.txt && | |
830 | echo new >to-revert.txt && | |
831 | test_commit new to-revert.txt && | |
87e139c0 MM |
832 | TO_REVERT=$(git rev-parse --short HEAD^) && |
833 | test_must_fail git revert $TO_REVERT && | |
59c22205 | 834 | cat >expected <<EOF && |
1c7969c9 MM |
835 | On branch master |
836 | You are currently reverting commit $TO_REVERT. | |
837 | (fix conflicts and run "git revert --continue") | |
838 | (use "git revert --abort" to cancel the revert operation) | |
839 | ||
840 | Unmerged paths: | |
80f537f7 | 841 | (use "git restore --staged <file>..." to unstage) |
1c7969c9 | 842 | (use "git add <file>..." to mark resolution) |
c7cb333f | 843 | both modified: to-revert.txt |
1c7969c9 MM |
844 | |
845 | no changes added to commit (use "git add" and/or "git commit -a") | |
846 | EOF | |
db4ef449 MM |
847 | git status --untracked-files=no >actual && |
848 | test_i18ncmp expected actual | |
849 | ' | |
850 | ||
851 | test_expect_success 'status while reverting commit (conflicts resolved)' ' | |
852 | echo reverted >to-revert.txt && | |
853 | git add to-revert.txt && | |
59c22205 | 854 | cat >expected <<EOF && |
1c7969c9 MM |
855 | On branch master |
856 | You are currently reverting commit $TO_REVERT. | |
857 | (all conflicts fixed: run "git revert --continue") | |
858 | (use "git revert --abort" to cancel the revert operation) | |
859 | ||
860 | Changes to be committed: | |
80f537f7 | 861 | (use "git restore --staged <file>..." to unstage) |
1c7969c9 MM |
862 | modified: to-revert.txt |
863 | ||
864 | Untracked files not listed (use -u option to show untracked files) | |
865 | EOF | |
db4ef449 MM |
866 | git status --untracked-files=no >actual && |
867 | test_i18ncmp expected actual | |
868 | ' | |
869 | ||
870 | test_expect_success 'status after reverting commit' ' | |
871 | git revert --continue && | |
59c22205 | 872 | cat >expected <<\EOF && |
1c7969c9 MM |
873 | On branch master |
874 | nothing to commit (use -u to show untracked files) | |
4a72486d PW |
875 | EOF |
876 | git status --untracked-files=no >actual && | |
877 | test_i18ncmp expected actual | |
878 | ' | |
879 | ||
880 | test_expect_success 'status while reverting after committing conflict resolution' ' | |
881 | test_when_finished "git revert --abort" && | |
882 | git reset --hard new && | |
883 | test_must_fail git revert old new && | |
884 | echo reverted >to-revert.txt && | |
885 | git commit -a && | |
886 | cat >expected <<EOF && | |
887 | On branch master | |
888 | Revert currently in progress. | |
889 | (run "git revert --continue" to continue) | |
890 | (use "git revert --abort" to cancel the revert operation) | |
891 | ||
892 | nothing to commit (use -u to show untracked files) | |
1c7969c9 | 893 | EOF |
db4ef449 MM |
894 | git status --untracked-files=no >actual && |
895 | test_i18ncmp expected actual | |
896 | ' | |
897 | ||
592e412d GP |
898 | test_expect_success 'prepare for different number of commits rebased' ' |
899 | git reset --hard master && | |
900 | git checkout -b several_commits && | |
901 | test_commit one_commit main.txt one && | |
902 | test_commit two_commit main.txt two && | |
903 | test_commit three_commit main.txt three && | |
904 | test_commit four_commit main.txt four | |
905 | ' | |
906 | ||
907 | test_expect_success 'status: one command done nothing remaining' ' | |
908 | FAKE_LINES="exec_exit_15" && | |
909 | export FAKE_LINES && | |
910 | test_when_finished "git rebase --abort" && | |
911 | ONTO=$(git rev-parse --short HEAD~3) && | |
912 | test_must_fail git rebase -i HEAD~3 && | |
913 | cat >expected <<EOF && | |
914 | interactive rebase in progress; onto $ONTO | |
915 | Last command done (1 command done): | |
916 | exec exit 15 | |
917 | No commands remaining. | |
918 | You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. | |
919 | (use "git commit --amend" to amend the current commit) | |
920 | (use "git rebase --continue" once you are satisfied with your changes) | |
921 | ||
922 | nothing to commit (use -u to show untracked files) | |
923 | EOF | |
924 | git status --untracked-files=no >actual && | |
925 | test_i18ncmp expected actual | |
926 | ' | |
927 | ||
928 | test_expect_success 'status: two commands done with some white lines in done file' ' | |
929 | FAKE_LINES="1 > exec_exit_15 2 3" && | |
930 | export FAKE_LINES && | |
931 | test_when_finished "git rebase --abort" && | |
932 | ONTO=$(git rev-parse --short HEAD~3) && | |
933 | COMMIT4=$(git rev-parse --short HEAD) && | |
934 | COMMIT3=$(git rev-parse --short HEAD^) && | |
935 | COMMIT2=$(git rev-parse --short HEAD^^) && | |
936 | test_must_fail git rebase -i HEAD~3 && | |
937 | cat >expected <<EOF && | |
938 | interactive rebase in progress; onto $ONTO | |
939 | Last commands done (2 commands done): | |
940 | pick $COMMIT2 two_commit | |
941 | exec exit 15 | |
942 | Next commands to do (2 remaining commands): | |
943 | pick $COMMIT3 three_commit | |
944 | pick $COMMIT4 four_commit | |
945 | (use "git rebase --edit-todo" to view and edit) | |
946 | You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. | |
947 | (use "git commit --amend" to amend the current commit) | |
948 | (use "git rebase --continue" once you are satisfied with your changes) | |
949 | ||
950 | nothing to commit (use -u to show untracked files) | |
951 | EOF | |
952 | git status --untracked-files=no >actual && | |
953 | test_i18ncmp expected actual | |
954 | ' | |
955 | ||
956 | test_expect_success 'status: two remaining commands with some white lines in todo file' ' | |
957 | FAKE_LINES="1 2 exec_exit_15 3 > 4" && | |
958 | export FAKE_LINES && | |
959 | test_when_finished "git rebase --abort" && | |
960 | ONTO=$(git rev-parse --short HEAD~4) && | |
961 | COMMIT4=$(git rev-parse --short HEAD) && | |
962 | COMMIT3=$(git rev-parse --short HEAD^) && | |
963 | COMMIT2=$(git rev-parse --short HEAD^^) && | |
964 | test_must_fail git rebase -i HEAD~4 && | |
965 | cat >expected <<EOF && | |
966 | interactive rebase in progress; onto $ONTO | |
967 | Last commands done (3 commands done): | |
968 | pick $COMMIT2 two_commit | |
969 | exec exit 15 | |
970 | (see more in file .git/rebase-merge/done) | |
971 | Next commands to do (2 remaining commands): | |
972 | pick $COMMIT3 three_commit | |
973 | pick $COMMIT4 four_commit | |
974 | (use "git rebase --edit-todo" to view and edit) | |
975 | You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. | |
976 | (use "git commit --amend" to amend the current commit) | |
977 | (use "git rebase --continue" once you are satisfied with your changes) | |
978 | ||
979 | nothing to commit (use -u to show untracked files) | |
980 | EOF | |
981 | git status --untracked-files=no >actual && | |
982 | test_i18ncmp expected actual | |
983 | ' | |
984 | ||
df9ded49 JS |
985 | test_expect_success 'status: handle not-yet-started rebase -i gracefully' ' |
986 | ONTO=$(git rev-parse --short HEAD^) && | |
987 | COMMIT=$(git rev-parse --short HEAD) && | |
988 | EDITOR="git status --untracked-files=no >actual" git rebase -i HEAD^ && | |
989 | cat >expected <<EOF && | |
990 | On branch several_commits | |
991 | No commands done. | |
992 | Next command to do (1 remaining command): | |
993 | pick $COMMIT four_commit | |
994 | (use "git rebase --edit-todo" to view and edit) | |
995 | You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''. | |
996 | (use "git commit --amend" to amend the current commit) | |
997 | (use "git rebase --continue" once you are satisfied with your changes) | |
998 | ||
999 | nothing to commit (use -u to show untracked files) | |
1000 | EOF | |
1001 | test_i18ncmp expected actual | |
1002 | ' | |
1003 | ||
70819263 | 1004 | test_done |