Skip to content

Commit

Permalink
status: give more information during rebase -i
Browse files Browse the repository at this point in the history
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 <guillaume.pages@ensimag.grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Guillaume Pagès authored and gitster committed Jul 6, 2015
1 parent df25e94 commit 84e6fb9
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 0 deletions.
111 changes: 111 additions & 0 deletions t/t7512-status-help.sh
Expand Up @@ -134,9 +134,13 @@ test_expect_success 'prepare for rebase_i_conflicts' '
test_expect_success 'status during rebase -i when conflicts unresolved' '
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short rebase_i_conflicts) &&
LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) &&
test_must_fail git rebase -i rebase_i_conflicts &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last command done (1 command done):
pick $LAST_COMMIT one_second
No commands remaining.
You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
Expand All @@ -159,10 +163,14 @@ test_expect_success 'status during rebase -i after resolving conflicts' '
git reset --hard rebase_i_conflicts_second &&
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short rebase_i_conflicts) &&
LAST_COMMIT=$(git rev-parse --short rebase_i_conflicts_second) &&
test_must_fail git rebase -i rebase_i_conflicts &&
git add main.txt &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last command done (1 command done):
pick $LAST_COMMIT one_second
No commands remaining.
You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
(all conflicts fixed: run "git rebase --continue")
Expand All @@ -183,14 +191,20 @@ test_expect_success 'status when rebasing -i in edit mode' '
git checkout -b rebase_i_edit &&
test_commit one_rebase_i main.txt one &&
test_commit two_rebase_i main.txt two &&
COMMIT2=$(git rev-parse --short rebase_i_edit) &&
test_commit three_rebase_i main.txt three &&
COMMIT3=$(git rev-parse --short rebase_i_edit) &&
FAKE_LINES="1 edit 2" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD~2) &&
git rebase -i HEAD~2 &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
pick $COMMIT2 two_rebase_i
edit $COMMIT3 three_rebase_i
No commands remaining.
You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -207,8 +221,11 @@ test_expect_success 'status when splitting a commit' '
git checkout -b split_commit &&
test_commit one_split main.txt one &&
test_commit two_split main.txt two &&
COMMIT2=$(git rev-parse --short split_commit) &&
test_commit three_split main.txt three &&
COMMIT3=$(git rev-parse --short split_commit) &&
test_commit four_split main.txt four &&
COMMIT4=$(git rev-parse --short split_commit) &&
FAKE_LINES="1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
Expand All @@ -217,6 +234,12 @@ test_expect_success 'status when splitting a commit' '
git reset HEAD^ &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
pick $COMMIT2 two_split
edit $COMMIT3 three_split
Next command to do (1 remaining command):
pick $COMMIT4 four_split
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''split_commit'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
Expand All @@ -239,7 +262,9 @@ test_expect_success 'status after editing the last commit with --amend during a
test_commit one_amend main.txt one &&
test_commit two_amend main.txt two &&
test_commit three_amend main.txt three &&
COMMIT3=$(git rev-parse --short amend_last) &&
test_commit four_amend main.txt four &&
COMMIT4=$(git rev-parse --short amend_last) &&
FAKE_LINES="1 2 edit 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
Expand All @@ -248,6 +273,11 @@ test_expect_success 'status after editing the last commit with --amend during a
git commit --amend -m "foo" &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (3 commands done):
pick $COMMIT3 three_amend
edit $COMMIT4 four_amend
(see more in file .git/rebase-merge/done)
No commands remaining.
You are currently editing a commit while rebasing branch '\''amend_last'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -273,11 +303,20 @@ test_expect_success 'status: (continue first edit) second edit' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git rebase --continue &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -294,12 +333,21 @@ test_expect_success 'status: (continue first edit) second edit and split' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git rebase --continue &&
git reset HEAD^ &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
Expand All @@ -321,12 +369,21 @@ test_expect_success 'status: (continue first edit) second edit and amend' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git rebase --continue &&
git commit --amend -m "foo" &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -343,12 +400,21 @@ test_expect_success 'status: (amend first edit) second edit' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git commit --amend -m "a" &&
git rebase --continue &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -366,12 +432,21 @@ test_expect_success 'status: (amend first edit) second edit and split' '
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD~3) &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
git rebase -i HEAD~3 &&
git commit --amend -m "b" &&
git rebase --continue &&
git reset HEAD^ &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
Expand All @@ -393,13 +468,22 @@ test_expect_success 'status: (amend first edit) second edit and amend' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git commit --amend -m "c" &&
git rebase --continue &&
git commit --amend -m "d" &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -416,6 +500,9 @@ test_expect_success 'status: (split first edit) second edit' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git reset HEAD^ &&
Expand All @@ -424,6 +511,12 @@ test_expect_success 'status: (split first edit) second edit' '
git rebase --continue &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand All @@ -440,6 +533,9 @@ test_expect_success 'status: (split first edit) second edit and split' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git reset HEAD^ &&
Expand All @@ -449,6 +545,12 @@ test_expect_success 'status: (split first edit) second edit and split' '
git reset HEAD^ &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
Expand All @@ -470,6 +572,9 @@ test_expect_success 'status: (split first edit) second edit and amend' '
FAKE_LINES="edit 1 edit 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
COMMIT2=$(git rev-parse --short several_edits^^) &&
COMMIT3=$(git rev-parse --short several_edits^) &&
COMMIT4=$(git rev-parse --short several_edits) &&
ONTO=$(git rev-parse --short HEAD~3) &&
git rebase -i HEAD~3 &&
git reset HEAD^ &&
Expand All @@ -479,6 +584,12 @@ test_expect_success 'status: (split first edit) second edit and amend' '
git commit --amend -m "h" &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
edit $COMMIT2 two_edits
edit $COMMIT3 three_edits
Next command to do (1 remaining command):
pick $COMMIT4 four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Expand Down

0 comments on commit 84e6fb9

Please sign in to comment.