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

[RFC/PATCH 1/3] t7503/4: Add failing testcases for revert/cherry-pick --no-verify

From
Johan Herland <johan@herland.net>
Date
Sep 3, 2014, 14:03 UTC
Message-ID
<1409753034-9459-2-git-send-email-johan@herland.net>
In-Reply-To
<1409753034-9459-1-git-send-email-johan@herland.net>

The revert/cherry-pick machinery currently exercises the pre-commit and commit-msg hooks. However, where commit accepts a --no-verify option to temporarily disable these hooks, the revert and cherry-pick commands have no such option.

This patch adds some testcases demonstrating how the --no-verify option is supposed when it is added to revert and cherry-pick (in the next patch).

Signed-off-by: Johan Herland <johan@herland.net>
---
 t/t7503-pre-commit-hook.sh | 24 ++++++++++++++++++++++++
 t/t7504-commit-msg-hook.sh | 24 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
diff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh
index 984889b..adc892b 100755
--- a/t/t7503-pre-commit-hook.sh
+++ b/t/t7503-pre-commit-hook.sh
@@ -60,6 +60,18 @@ test_expect_success 'with failing hook' '
 
 '
 
+test_expect_success 'revert with failing hook' '
+
+	test_must_fail git revert HEAD
+
+'
+
+test_expect_success 'cherry-pick with failing hook' '
+
+	test_must_fail git cherry-pick --no-verify HEAD^
+
+'
+
 test_expect_success '--no-verify with failing hook' '
 
 	echo "stuff" >> file &&
@@ -68,6 +80,18 @@ test_expect_success '--no-verify with failing hook' '
 
 '
 
+test_expect_failure 'revert --no-verify with failing hook' '
+
+	git revert --no-verify HEAD
+
+'
+
+test_expect_failure 'cherry-pick --no-verify with failing hook' '
+
+	git cherry-pick --no-verify HEAD^
+
+'
+
 chmod -x "$HOOK"
 test_expect_success POSIXPERM 'with non-executable hook' '
 
diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index 1f53ea8..4f8b9fe 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -109,6 +109,18 @@ test_expect_success 'with failing hook' '
 
 '
 
+test_expect_success 'revert with failing hook' '
+
+	test_must_fail git revert HEAD
+
+'
+
+test_expect_success 'cherry-pick with failing hook' '
+
+	test_must_fail git cherry-pick --no-verify HEAD^
+
+'
+
 test_expect_success 'with failing hook (editor)' '
 
 	echo "more another" >> file &&
@@ -126,6 +138,18 @@ test_expect_success '--no-verify with failing hook' '
 
 '
 
+test_expect_failure 'revert --no-verify with failing hook' '
+
+	git revert --no-verify HEAD
+
+'
+
+test_expect_failure 'cherry-pick --no-verify with failing hook' '
+
+	git cherry-pick --no-verify HEAD^
+
+'
+
 test_expect_success '--no-verify with failing hook (editor)' '
 
 	echo "more stuff" >> file &&
-- 
2.0.0.rc4.501.gdaf83ca
Previous: Johan HerlandNext: Junio C Hamano
Message 2 of 20 in “Teach revert/cherry-pick the --no-verify option”
  1. 0/3 Teach revert/cherry-pick the --no-verify optionJohan Herland, Sep 3, 2014
  2. 1/3 t7503/4: Add failing testcases for revert/cherry-pick --no-verifyJohan Herland, Sep 3, 2014
  3. Junio C HamanoSep 3, 2014
  4. 2/3 revert/cherry-pick: Add --no-verify option, and pass it on to commitJohan Herland, Sep 3, 2014
  5. Junio C HamanoSep 3, 2014
  6. parse-options: detect attempt to add a duplicate short option nameJunio C Hamano, Sep 3, 2014
  7. René ScharfeSep 3, 2014
  8. Junio C HamanoSep 3, 2014
  9. René ScharfeSep 3, 2014
  10. Junio C HamanoSep 3, 2014
  11. René ScharfeSep 4, 2014
  12. Junio C HamanoSep 4, 2014
  13. Junio C HamanoSep 4, 2014
  14. Jonathan NiederSep 3, 2014
  15. Jonathan NiederSep 3, 2014
  16. Johan HerlandSep 4, 2014
  17. 3/3 revert/cherry-pick --no-verify: Update documentationJohan Herland, Sep 3, 2014
  18. Junio C HamanoSep 3, 2014
  19. Fabian RuchSep 5, 2014
  20. Johan HerlandSep 8, 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.