git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/6] merge hook tests: fix and update tests

From
Benoit Pierre <benoit.pierre@gmail.com>
Date
Mar 6, 2014, 14:50 UTC
Message-ID
<1394117424-29780-5-git-send-email-benoit.pierre@gmail.com>
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
Previous: Benoit PierreNext: Eric Sunshine
Message 9 of 16 in “fix hunk editing with 'commit -p -m'”
  1. 0/6 fix hunk editing with 'commit -p -m'Benoit Pierre, Mar 6, 2014
  2. 1/6 test patch hunk editing with "commit -p -m"Benoit Pierre, Mar 6, 2014
  3. Eric SunshineMar 6, 2014
  4. Junio C HamanoMar 6, 2014
  5. 2/6 commit: fix patch hunk editing with "commit -p -m"Benoit Pierre, Mar 6, 2014
  6. Junio C HamanoMar 6, 2014
  7. Junio C HamanoMar 6, 2014
  8. 3/6 merge: fix GIT_EDITOR override for commit hookBenoit Pierre, Mar 6, 2014
  9. 4/6 merge hook tests: fix and update testsBenoit Pierre, Mar 6, 2014
  10. Eric SunshineMar 6, 2014
  11. 5/6 merge hook tests: fix missing '&&' in testBenoit Pierre, Mar 6, 2014
  12. Junio C HamanoMar 6, 2014
  13. 6/6 merge hook tests: use 'test_must_fail' instead of '!'Benoit Pierre, Mar 6, 2014
  14. Junio C HamanoMar 6, 2014
  15. Junio C HamanoMar 7, 2014
  16. Junio C HamanoMar 6, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.