Skip to content

Commit 09feffb

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bdccd3c commit 09feffb

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

t/t7502-commit.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,6 @@ test_expect_success 'message shows author when it is not equal to committer' '
243243
.git/COMMIT_EDITMSG
244244
'
245245

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-
256246
test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
257247
258248
echo >>negative &&
@@ -271,7 +261,7 @@ echo editor started > "$(pwd)/.git/result"
271261
exit 0
272262
EOF
273263

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' '
275265
>.git/result
276266
>expect &&
277267

t/test-lib.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,12 @@ test_lazy_prereq UTF8_NFD_TO_NFC '
738738
esac
739739
'
740740

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+
741747
# When the tests are run as root, permission tests will report that
742748
# things are writable when they shouldn't be.
743749
test -w / || test_set_prereq SANITY

0 commit comments

Comments
 (0)