t7502: factor out autoident prerequisite

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Nov 14, 2012 at 16:33 UTC 09feffb633d9e27fa2f3b96ff7c367baa3164ce0
2 files changed +7 -11
t/t7502-commit.sh
+1 -11
@@ -243,16 +243,6 @@ test_expect_success 'message shows author when it is not equal to committer' '
243 .git/COMMIT_EDITMSG
244 '
245
246 -test_expect_success 'setup auto-ident prerequisite' '
247 - if (sane_unset GIT_COMMITTER_EMAIL &&
248 - sane_unset GIT_COMMITTER_NAME &&
249 - git var GIT_COMMITTER_IDENT); then
250 - test_set_prereq AUTOIDENT
251 - else
252 - test_set_prereq NOAUTOIDENT
253 - fi
254 -'
255 -
246 test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
247
248 echo >>negative &&
@@ -271,7 +261,7 @@ echo editor started > "$(pwd)/.git/result"
261 exit 0
262 EOF
263
274 -test_expect_success NOAUTOIDENT 'do not fire editor when committer is bogus' '
264 +test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
265 >.git/result
266 >expect &&
267
t/test-lib.sh
+6
@@ -738,6 +738,12 @@ test_lazy_prereq UTF8_NFD_TO_NFC '
738 esac
739 '
740
741 +test_lazy_prereq AUTOIDENT '
742 + sane_unset GIT_AUTHOR_NAME &&
743 + sane_unset GIT_AUTHOR_EMAIL &&
744 + git var GIT_AUTHOR_IDENT
745 +'
746 +
747 # When the tests are run as root, permission tests will report that
748 # things are writable when they shouldn't be.
749 test -w / || test_set_prereq SANITY