Skip to content

Commit

Permalink
status: add new tests for status during rebase -i
Browse files Browse the repository at this point in the history
Expand test coverage with one or more than two commands done
and with zero, one or more than two commands remaining.

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 Junio C Hamano committed Jul 6, 2015
1 parent 84e6fb9 commit 592e412
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions t/t7512-status-help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -856,4 +856,91 @@ EOF
test_i18ncmp expected actual
'

test_expect_success 'prepare for different number of commits rebased' '
git reset --hard master &&
git checkout -b several_commits &&
test_commit one_commit main.txt one &&
test_commit two_commit main.txt two &&
test_commit three_commit main.txt three &&
test_commit four_commit main.txt four
'

test_expect_success 'status: one command done nothing remaining' '
FAKE_LINES="exec_exit_15" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD~3) &&
test_must_fail git rebase -i HEAD~3 &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last command done (1 command done):
exec exit 15
No commands remaining.
You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
test_i18ncmp expected actual
'

test_expect_success 'status: two commands done with some white lines in done file' '
FAKE_LINES="1 > exec_exit_15 2 3" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD~3) &&
COMMIT4=$(git rev-parse --short HEAD) &&
COMMIT3=$(git rev-parse --short HEAD^) &&
COMMIT2=$(git rev-parse --short HEAD^^) &&
test_must_fail git rebase -i HEAD~3 &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
pick $COMMIT2 two_commit
exec exit 15
Next commands to do (2 remaining commands):
pick $COMMIT3 three_commit
pick $COMMIT4 four_commit
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
test_i18ncmp expected actual
'

test_expect_success 'status: two remaining commands with some white lines in todo file' '
FAKE_LINES="1 2 exec_exit_15 3 > 4" &&
export FAKE_LINES &&
test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD~4) &&
COMMIT4=$(git rev-parse --short HEAD) &&
COMMIT3=$(git rev-parse --short HEAD^) &&
COMMIT2=$(git rev-parse --short HEAD^^) &&
test_must_fail git rebase -i HEAD~4 &&
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (3 commands done):
pick $COMMIT2 two_commit
exec exit 15
(see more in file .git/rebase-merge/done)
Next commands to do (2 remaining commands):
pick $COMMIT3 three_commit
pick $COMMIT4 four_commit
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
test_i18ncmp expected actual
'

test_done

0 comments on commit 592e412

Please sign in to comment.