Skip to content

Commit

Permalink
t7502: factor out autoident prerequisite
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Nov 16, 2012
1 parent bdccd3c commit 09feffb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 1 addition & 11 deletions t/t7502-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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 &&
Expand Down
6 changes: 6 additions & 0 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 09feffb

Please sign in to comment.