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

[PATCH 2/5] t7502: factor out autoident prerequisite

From
Jeff King <peff@peff.net>
Date
Nov 28, 2012, 18:26 UTC
Message-ID
<20121128182606.GB17122@sigill.intra.peff.net>
In-Reply-To
<20121128182534.GA21020@sigill.intra.peff.net>

t7502 checks the behavior of commit when we can and cannot determine a valid committer ident. Let's move that into test-lib as a lazy prerequisite so other scripts can use it.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7502-commit.sh | 12 +-----------
 t/test-lib.sh     |  6 ++++++
 2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index deb187e..1a5cb69 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -243,16 +243,6 @@ test_expect_success 'message shows author when it is not equal to committer' '
 	  .git/COMMIT_EDITMSG
 '
 
-test_expect_success 'setup auto-ident prerequisite' '
-	if (sane_unset GIT_COMMITTER_EMAIL &&
-	    sane_unset GIT_COMMITTER_NAME &&
-	    git var GIT_COMMITTER_IDENT); then
-		test_set_prereq AUTOIDENT
-	else
-		test_set_prereq NOAUTOIDENT
-	fi
-'
-
 test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
 
 	echo >>negative &&
@@ -271,7 +261,7 @@ echo editor started > "$(pwd)/.git/result"
 exit 0
 EOF
 
-test_expect_success NOAUTOIDENT 'do not fire editor when committer is bogus' '
+test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
 	>.git/result
 	>expect &&
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 489bc80..0334a9e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -738,6 +738,12 @@ test_lazy_prereq UTF8_NFD_TO_NFC '
 	esac
 '
 
+test_lazy_prereq AUTOIDENT '
+	sane_unset GIT_AUTHOR_NAME &&
+	sane_unset GIT_AUTHOR_EMAIL &&
+	git var GIT_AUTHOR_IDENT
+'
+
 # When the tests are run as root, permission tests will report that
 # things are writable when they shouldn't be.
 test -w / || test_set_prereq SANITY
-- 
1.8.0.207.gdf2154c
Previous: Jeff KingNext: Jeff King
Message 3 of 12 in “jk/send-email-sender-prompt loose ends”
  1. 0/5 jk/send-email-sender-prompt loose endsJeff King, Nov 28, 2012
  2. 1/5 test-lib: allow negation of prerequisitesJeff King, Nov 28, 2012
  3. 2/5 t7502: factor out autoident prerequisiteJeff King, Nov 28, 2012
  4. 3/5 ident: make user_ident_explicitly_given staticJeff King, Nov 28, 2012
  5. 4/5 ident: keep separate "explicit" flags for author and committerJeff King, Nov 28, 2012
  6. 5/5 t: add tests for "git var"Jeff King, Nov 28, 2012
  7. 6/5 t9001: check send-email behavior with implicit senderJeff King, Nov 28, 2012
  8. Junio C HamanoNov 28, 2012
  9. Jeff KingNov 28, 2012
  10. Jeff KingNov 28, 2012
  11. Junio C HamanoNov 28, 2012
  12. Felipe ContrerasNov 28, 2012

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.