git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: gitster@pobox.com
Cc: git@vger.kernel.org, remi.lespinet@ensimag.grenoble-inp.fr,
	guillaume.pages@ensimag.grenoble-inp.fr,
	louis--alexandre.stuber@ensimag.grenoble-inp.fr,
	antoine.delaite@ensimag.grenoble-inp.fr,
	Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH v5 4/4] status: add new tests for status during rebase -i
Date: Wed,  1 Jul 2015 10:30:33 +0200	[thread overview]
Message-ID: <1435739433-18853-4-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1435739433-18853-1-git-send-email-Matthieu.Moy@imag.fr>

From: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>

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>
---
Added --short where appropriate.

 t/t7512-status-help.sh | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index 9be0235..49d19a3 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -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
-- 
2.5.0.rc0.7.ge1edd74

      parent reply	other threads:[~2015-07-01  8:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 13:01 [PATCH v4 0/4] More helpful 'git status' during 'rebase -i' Matthieu Moy
2015-06-30 13:01 ` [PATCH v4 1/4] status: factor two rebase-related messages together Matthieu Moy
2015-06-30 13:01 ` [PATCH v4 2/4] status: differentiate interactive from non-interactive rebases Matthieu Moy
2015-06-30 13:01 ` [PATCH v4 3/4] status: give more information during rebase -i Matthieu Moy
2015-06-30 13:01 ` [PATCH v4 4/4] status: add new tests for status " Matthieu Moy
2015-06-30 23:03 ` [PATCH v4 0/4] More helpful 'git status' during 'rebase -i' Junio C Hamano
2015-07-01  8:12   ` Matthieu Moy
2015-07-01  8:30     ` [PATCH v5 1/4] status: factor two rebase-related messages together Matthieu Moy
2015-07-01  8:30       ` [PATCH v5 2/4] status: differentiate interactive from non-interactive rebases Matthieu Moy
2015-07-01  8:30       ` [PATCH v5 3/4] status: give more information during rebase -i Matthieu Moy
2015-07-01 16:18         ` Junio C Hamano
2015-07-01 16:33           ` Eric Sunshine
2015-07-01 16:36             ` Junio C Hamano
2015-07-01 16:37               ` Eric Sunshine
2015-07-01 21:06           ` Matthieu Moy
2015-07-01 21:08             ` [PATCH v6 1/4] status: factor two rebase-related messages together Matthieu Moy
2015-07-01 21:08               ` [PATCH v6 2/4] status: differentiate interactive from non-interactive rebases Matthieu Moy
2015-07-01 21:08               ` [PATCH v6 3/4] status: give more information during rebase -i Matthieu Moy
2015-07-07 22:14                 ` Junio C Hamano
2015-07-08  7:10                   ` Matthieu Moy
2015-07-01 21:08               ` [PATCH v6 4/4] status: add new tests for status " Matthieu Moy
2015-07-01 21:23             ` [PATCH v5 3/4] status: give more information " Junio C Hamano
2015-07-02  8:01               ` Matthieu Moy
2015-07-03 17:40                 ` Junio C Hamano
2015-07-02  8:10               ` Matthieu Moy
2015-07-01  8:30       ` Matthieu Moy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435739433-18853-4-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=antoine.delaite@ensimag.grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=guillaume.pages@ensimag.grenoble-inp.fr \
    --cc=louis--alexandre.stuber@ensimag.grenoble-inp.fr \
    --cc=remi.lespinet@ensimag.grenoble-inp.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).