Skip to content

Commit 84e6fb9

Browse files
Guillaume Pagèsgitster
authored andcommitted
status: give more information during rebase -i
git status gives more information during rebase -i, about the list of command that are done during the rebase. It displays the two last commands executed and the two next lines to be executed. It also gives hints to find the whole files in .git directory. Signed-off-by: Guillaume Pagès <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent df25e94 commit 84e6fb9

File tree

2 files changed

+225
-0
lines changed

2 files changed

+225
-0
lines changed

t/t7512-status-help.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,13 @@ test_expect_success 'prepare for rebase_i_conflicts' '
134134
test_expect_success 'status during rebase -i when conflicts unresolved' '
135135
test_when_finished "git rebase --abort" &&
136136
ONTO=$(git rev-parse --short rebase_i_conflicts) &&
137+
LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) &&
137138
test_must_fail git rebase -i rebase_i_conflicts &&
138139
cat >expected <<EOF &&
139140
interactive rebase in progress; onto $ONTO
141+
Last command done (1 command done):
142+
pick $LAST_COMMIT one_second
143+
No commands remaining.
140144
You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
141145
(fix conflicts and then run "git rebase --continue")
142146
(use "git rebase --skip" to skip this patch)
@@ -159,10 +163,14 @@ test_expect_success 'status during rebase -i after resolving conflicts' '
159163
git reset --hard rebase_i_conflicts_second &&
160164
test_when_finished "git rebase --abort" &&
161165
ONTO=$(git rev-parse --short rebase_i_conflicts) &&
166+
LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) &&
162167
test_must_fail git rebase -i rebase_i_conflicts &&
163168
git add main.txt &&
164169
cat >expected <<EOF &&
165170
interactive rebase in progress; onto $ONTO
171+
Last command done (1 command done):
172+
pick $LAST_COMMIT one_second
173+
No commands remaining.
166174
You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
167175
(all conflicts fixed: run "git rebase --continue")
168176
@@ -183,14 +191,20 @@ test_expect_success 'status when rebasing -i in edit mode' '
183191
git checkout -b rebase_i_edit &&
184192
test_commit one_rebase_i main.txt one &&
185193
test_commit two_rebase_i main.txt two &&
194+
COMMIT2=$(git rev-parse --short rebase_i_edit) &&
186195
test_commit three_rebase_i main.txt three &&
196+
COMMIT3=$(git rev-parse --short rebase_i_edit) &&
187197
FAKE_LINES="1 edit 2" &&
188198
export FAKE_LINES &&
189199
test_when_finished "git rebase --abort" &&
190200
ONTO=$(git rev-parse --short HEAD~2) &&
191201
git rebase -i HEAD~2 &&
192202
cat >expected <<EOF &&
193203
interactive rebase in progress; onto $ONTO
204+
Last commands done (2 commands done):
205+
pick $COMMIT2 two_rebase_i
206+
edit $COMMIT3 three_rebase_i
207+
No commands remaining.
194208
You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' on '\''$ONTO'\''.
195209
(use "git commit --amend" to amend the current commit)
196210
(use "git rebase --continue" once you are satisfied with your changes)
@@ -207,8 +221,11 @@ test_expect_success 'status when splitting a commit' '
207221
git checkout -b split_commit &&
208222
test_commit one_split main.txt one &&
209223
test_commit two_split main.txt two &&
224+
COMMIT2=$(git rev-parse --short split_commit) &&
210225
test_commit three_split main.txt three &&
226+
COMMIT3=$(git rev-parse --short split_commit) &&
211227
test_commit four_split main.txt four &&
228+
COMMIT4=$(git rev-parse --short split_commit) &&
212229
FAKE_LINES="1 edit 2 3" &&
213230
export FAKE_LINES &&
214231
test_when_finished "git rebase --abort" &&
@@ -217,6 +234,12 @@ test_expect_success 'status when splitting a commit' '
217234
git reset HEAD^ &&
218235
cat >expected <<EOF &&
219236
interactive rebase in progress; onto $ONTO
237+
Last commands done (2 commands done):
238+
pick $COMMIT2 two_split
239+
edit $COMMIT3 three_split
240+
Next command to do (1 remaining command):
241+
pick $COMMIT4 four_split
242+
(use "git rebase --edit-todo" to view and edit)
220243
You are currently splitting a commit while rebasing branch '\''split_commit'\'' on '\''$ONTO'\''.
221244
(Once your working directory is clean, run "git rebase --continue")
222245
@@ -239,7 +262,9 @@ test_expect_success 'status after editing the last commit with --amend during a
239262
test_commit one_amend main.txt one &&
240263
test_commit two_amend main.txt two &&
241264
test_commit three_amend main.txt three &&
265+
COMMIT3=$(git rev-parse --short amend_last) &&
242266
test_commit four_amend main.txt four &&
267+
COMMIT4=$(git rev-parse --short amend_last) &&
243268
FAKE_LINES="1 2 edit 3" &&
244269
export FAKE_LINES &&
245270
test_when_finished "git rebase --abort" &&
@@ -248,6 +273,11 @@ test_expect_success 'status after editing the last commit with --amend during a
248273
git commit --amend -m "foo" &&
249274
cat >expected <<EOF &&
250275
interactive rebase in progress; onto $ONTO
276+
Last commands done (3 commands done):
277+
pick $COMMIT3 three_amend
278+
edit $COMMIT4 four_amend
279+
(see more in file .git/rebase-merge/done)
280+
No commands remaining.
251281
You are currently editing a commit while rebasing branch '\''amend_last'\'' on '\''$ONTO'\''.
252282
(use "git commit --amend" to amend the current commit)
253283
(use "git rebase --continue" once you are satisfied with your changes)
@@ -273,11 +303,20 @@ test_expect_success 'status: (continue first edit) second edit' '
273303
FAKE_LINES="edit 1 edit 2 3" &&
274304
export FAKE_LINES &&
275305
test_when_finished "git rebase --abort" &&
306+
COMMIT2=$(git rev-parse --short several_edits^^) &&
307+
COMMIT3=$(git rev-parse --short several_edits^) &&
308+
COMMIT4=$(git rev-parse --short several_edits) &&
276309
ONTO=$(git rev-parse --short HEAD~3) &&
277310
git rebase -i HEAD~3 &&
278311
git rebase --continue &&
279312
cat >expected <<EOF &&
280313
interactive rebase in progress; onto $ONTO
314+
Last commands done (2 commands done):
315+
edit $COMMIT2 two_edits
316+
edit $COMMIT3 three_edits
317+
Next command to do (1 remaining command):
318+
pick $COMMIT4 four_edits
319+
(use "git rebase --edit-todo" to view and edit)
281320
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
282321
(use "git commit --amend" to amend the current commit)
283322
(use "git rebase --continue" once you are satisfied with your changes)
@@ -294,12 +333,21 @@ test_expect_success 'status: (continue first edit) second edit and split' '
294333
FAKE_LINES="edit 1 edit 2 3" &&
295334
export FAKE_LINES &&
296335
test_when_finished "git rebase --abort" &&
336+
COMMIT2=$(git rev-parse --short several_edits^^) &&
337+
COMMIT3=$(git rev-parse --short several_edits^) &&
338+
COMMIT4=$(git rev-parse --short several_edits) &&
297339
ONTO=$(git rev-parse --short HEAD~3) &&
298340
git rebase -i HEAD~3 &&
299341
git rebase --continue &&
300342
git reset HEAD^ &&
301343
cat >expected <<EOF &&
302344
interactive rebase in progress; onto $ONTO
345+
Last commands done (2 commands done):
346+
edit $COMMIT2 two_edits
347+
edit $COMMIT3 three_edits
348+
Next command to do (1 remaining command):
349+
pick $COMMIT4 four_edits
350+
(use "git rebase --edit-todo" to view and edit)
303351
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
304352
(Once your working directory is clean, run "git rebase --continue")
305353
@@ -321,12 +369,21 @@ test_expect_success 'status: (continue first edit) second edit and amend' '
321369
FAKE_LINES="edit 1 edit 2 3" &&
322370
export FAKE_LINES &&
323371
test_when_finished "git rebase --abort" &&
372+
COMMIT2=$(git rev-parse --short several_edits^^) &&
373+
COMMIT3=$(git rev-parse --short several_edits^) &&
374+
COMMIT4=$(git rev-parse --short several_edits) &&
324375
ONTO=$(git rev-parse --short HEAD~3) &&
325376
git rebase -i HEAD~3 &&
326377
git rebase --continue &&
327378
git commit --amend -m "foo" &&
328379
cat >expected <<EOF &&
329380
interactive rebase in progress; onto $ONTO
381+
Last commands done (2 commands done):
382+
edit $COMMIT2 two_edits
383+
edit $COMMIT3 three_edits
384+
Next command to do (1 remaining command):
385+
pick $COMMIT4 four_edits
386+
(use "git rebase --edit-todo" to view and edit)
330387
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
331388
(use "git commit --amend" to amend the current commit)
332389
(use "git rebase --continue" once you are satisfied with your changes)
@@ -343,12 +400,21 @@ test_expect_success 'status: (amend first edit) second edit' '
343400
FAKE_LINES="edit 1 edit 2 3" &&
344401
export FAKE_LINES &&
345402
test_when_finished "git rebase --abort" &&
403+
COMMIT2=$(git rev-parse --short several_edits^^) &&
404+
COMMIT3=$(git rev-parse --short several_edits^) &&
405+
COMMIT4=$(git rev-parse --short several_edits) &&
346406
ONTO=$(git rev-parse --short HEAD~3) &&
347407
git rebase -i HEAD~3 &&
348408
git commit --amend -m "a" &&
349409
git rebase --continue &&
350410
cat >expected <<EOF &&
351411
interactive rebase in progress; onto $ONTO
412+
Last commands done (2 commands done):
413+
edit $COMMIT2 two_edits
414+
edit $COMMIT3 three_edits
415+
Next command to do (1 remaining command):
416+
pick $COMMIT4 four_edits
417+
(use "git rebase --edit-todo" to view and edit)
352418
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
353419
(use "git commit --amend" to amend the current commit)
354420
(use "git rebase --continue" once you are satisfied with your changes)
@@ -366,12 +432,21 @@ test_expect_success 'status: (amend first edit) second edit and split' '
366432
export FAKE_LINES &&
367433
test_when_finished "git rebase --abort" &&
368434
ONTO=$(git rev-parse --short HEAD~3) &&
435+
COMMIT2=$(git rev-parse --short several_edits^^) &&
436+
COMMIT3=$(git rev-parse --short several_edits^) &&
437+
COMMIT4=$(git rev-parse --short several_edits) &&
369438
git rebase -i HEAD~3 &&
370439
git commit --amend -m "b" &&
371440
git rebase --continue &&
372441
git reset HEAD^ &&
373442
cat >expected <<EOF &&
374443
interactive rebase in progress; onto $ONTO
444+
Last commands done (2 commands done):
445+
edit $COMMIT2 two_edits
446+
edit $COMMIT3 three_edits
447+
Next command to do (1 remaining command):
448+
pick $COMMIT4 four_edits
449+
(use "git rebase --edit-todo" to view and edit)
375450
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
376451
(Once your working directory is clean, run "git rebase --continue")
377452
@@ -393,13 +468,22 @@ test_expect_success 'status: (amend first edit) second edit and amend' '
393468
FAKE_LINES="edit 1 edit 2 3" &&
394469
export FAKE_LINES &&
395470
test_when_finished "git rebase --abort" &&
471+
COMMIT2=$(git rev-parse --short several_edits^^) &&
472+
COMMIT3=$(git rev-parse --short several_edits^) &&
473+
COMMIT4=$(git rev-parse --short several_edits) &&
396474
ONTO=$(git rev-parse --short HEAD~3) &&
397475
git rebase -i HEAD~3 &&
398476
git commit --amend -m "c" &&
399477
git rebase --continue &&
400478
git commit --amend -m "d" &&
401479
cat >expected <<EOF &&
402480
interactive rebase in progress; onto $ONTO
481+
Last commands done (2 commands done):
482+
edit $COMMIT2 two_edits
483+
edit $COMMIT3 three_edits
484+
Next command to do (1 remaining command):
485+
pick $COMMIT4 four_edits
486+
(use "git rebase --edit-todo" to view and edit)
403487
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
404488
(use "git commit --amend" to amend the current commit)
405489
(use "git rebase --continue" once you are satisfied with your changes)
@@ -416,6 +500,9 @@ test_expect_success 'status: (split first edit) second edit' '
416500
FAKE_LINES="edit 1 edit 2 3" &&
417501
export FAKE_LINES &&
418502
test_when_finished "git rebase --abort" &&
503+
COMMIT2=$(git rev-parse --short several_edits^^) &&
504+
COMMIT3=$(git rev-parse --short several_edits^) &&
505+
COMMIT4=$(git rev-parse --short several_edits) &&
419506
ONTO=$(git rev-parse --short HEAD~3) &&
420507
git rebase -i HEAD~3 &&
421508
git reset HEAD^ &&
@@ -424,6 +511,12 @@ test_expect_success 'status: (split first edit) second edit' '
424511
git rebase --continue &&
425512
cat >expected <<EOF &&
426513
interactive rebase in progress; onto $ONTO
514+
Last commands done (2 commands done):
515+
edit $COMMIT2 two_edits
516+
edit $COMMIT3 three_edits
517+
Next command to do (1 remaining command):
518+
pick $COMMIT4 four_edits
519+
(use "git rebase --edit-todo" to view and edit)
427520
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
428521
(use "git commit --amend" to amend the current commit)
429522
(use "git rebase --continue" once you are satisfied with your changes)
@@ -440,6 +533,9 @@ test_expect_success 'status: (split first edit) second edit and split' '
440533
FAKE_LINES="edit 1 edit 2 3" &&
441534
export FAKE_LINES &&
442535
test_when_finished "git rebase --abort" &&
536+
COMMIT2=$(git rev-parse --short several_edits^^) &&
537+
COMMIT3=$(git rev-parse --short several_edits^) &&
538+
COMMIT4=$(git rev-parse --short several_edits) &&
443539
ONTO=$(git rev-parse --short HEAD~3) &&
444540
git rebase -i HEAD~3 &&
445541
git reset HEAD^ &&
@@ -449,6 +545,12 @@ test_expect_success 'status: (split first edit) second edit and split' '
449545
git reset HEAD^ &&
450546
cat >expected <<EOF &&
451547
interactive rebase in progress; onto $ONTO
548+
Last commands done (2 commands done):
549+
edit $COMMIT2 two_edits
550+
edit $COMMIT3 three_edits
551+
Next command to do (1 remaining command):
552+
pick $COMMIT4 four_edits
553+
(use "git rebase --edit-todo" to view and edit)
452554
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
453555
(Once your working directory is clean, run "git rebase --continue")
454556
@@ -470,6 +572,9 @@ test_expect_success 'status: (split first edit) second edit and amend' '
470572
FAKE_LINES="edit 1 edit 2 3" &&
471573
export FAKE_LINES &&
472574
test_when_finished "git rebase --abort" &&
575+
COMMIT2=$(git rev-parse --short several_edits^^) &&
576+
COMMIT3=$(git rev-parse --short several_edits^) &&
577+
COMMIT4=$(git rev-parse --short several_edits) &&
473578
ONTO=$(git rev-parse --short HEAD~3) &&
474579
git rebase -i HEAD~3 &&
475580
git reset HEAD^ &&
@@ -479,6 +584,12 @@ test_expect_success 'status: (split first edit) second edit and amend' '
479584
git commit --amend -m "h" &&
480585
cat >expected <<EOF &&
481586
interactive rebase in progress; onto $ONTO
587+
Last commands done (2 commands done):
588+
edit $COMMIT2 two_edits
589+
edit $COMMIT3 three_edits
590+
Next command to do (1 remaining command):
591+
pick $COMMIT4 four_edits
592+
(use "git rebase --edit-todo" to view and edit)
482593
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
483594
(use "git commit --amend" to amend the current commit)
484595
(use "git rebase --continue" once you are satisfied with your changes)

0 commit comments

Comments
 (0)