git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benoit Pierre <benoit.pierre@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 4/6] merge hook tests: fix and update tests
Date: Thu,  6 Mar 2014 15:50:22 +0100	[thread overview]
Message-ID: <1394117424-29780-5-git-send-email-benoit.pierre@gmail.com> (raw)
In-Reply-To: <1394117424-29780-1-git-send-email-benoit.pierre@gmail.com>

- update 'no editor' hook test and add 'editor' hook test
- reset tree at the beginning of failing hook tests to avoid failures
  due to an unclean tree after running a previous test

Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com>
---
 t/t7505-prepare-commit-msg-hook.sh | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index 3573751..ae7b2db 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -141,7 +141,19 @@ test_expect_success 'with hook (merge)' '
 	git commit -m other &&
 	git checkout - &&
 	git merge other &&
-	test "`git log -1 --pretty=format:%s`" = merge
+	test "`git log -1 --pretty=format:%s`" = "merge (no editor)"
+'
+
+test_expect_success 'with hook and editor (merge)' '
+
+	head=`git rev-parse HEAD` &&
+	git checkout -B other HEAD@{1} &&
+	echo "more" >> file &&
+	git add file &&
+	git commit -m other &&
+	git checkout - &&
+	env GIT_EDITOR="\"\$FAKE_EDITOR\"" git merge -e other &&
+	test "`git log -1 --pretty=format:%s`" = "merge"
 '
 
 cat > "$HOOK" <<'EOF'
@@ -151,6 +163,7 @@ EOF
 
 test_expect_success 'with failing hook' '
 
+	git reset --hard &&
 	head=`git rev-parse HEAD` &&
 	echo "more" >> file &&
 	git add file &&
@@ -160,6 +173,7 @@ test_expect_success 'with failing hook' '
 
 test_expect_success 'with failing hook (--no-verify)' '
 
+	git reset --hard &&
 	head=`git rev-parse HEAD` &&
 	echo "more" >> file &&
 	git add file &&
@@ -169,6 +183,7 @@ test_expect_success 'with failing hook (--no-verify)' '
 
 test_expect_success 'with failing hook (merge)' '
 
+	git reset --hard &&
 	git checkout -B other HEAD@{1} &&
 	echo "more" >> file &&
 	git add file &&
-- 
1.9.0

  parent reply	other threads:[~2014-03-06 14:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 14:50 [PATCH 0/6] fix hunk editing with 'commit -p -m' Benoit Pierre
2014-03-06 14:50 ` [PATCH 1/6] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-06 22:07   ` Eric Sunshine
2014-03-06 23:11     ` Junio C Hamano
2014-03-06 14:50 ` [PATCH 2/6] commit: fix " Benoit Pierre
2014-03-06 21:25   ` Junio C Hamano
2014-03-06 21:47     ` Junio C Hamano
2014-03-06 14:50 ` [PATCH 3/6] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-06 14:50 ` Benoit Pierre [this message]
2014-03-06 22:11   ` [PATCH 4/6] merge hook tests: fix and update tests Eric Sunshine
2014-03-06 14:50 ` [PATCH 5/6] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-06 21:27   ` Junio C Hamano
2014-03-06 14:50 ` [PATCH 6/6] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-06 21:29   ` Junio C Hamano
2014-03-07  0:35     ` Junio C Hamano
2014-03-06 21:15 ` [PATCH 0/6] fix hunk editing with 'commit -p -m' Junio C Hamano

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

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

  git send-email \
    --in-reply-to=1394117424-29780-5-git-send-email-benoit.pierre@gmail.com \
    --to=benoit.pierre@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).