3 # Copyright (c) 2016 Dan Aloni
4 # Copyright (c) 2016 Jeff King
7 test_description
='per-repo forced setting of email address'
11 test_expect_success
'setup a likely user.useConfigOnly use case' '
12 # we want to make sure a reflog is written, since that needs
13 # a non-strict ident. So be sure we have an actual commit.
16 sane_unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL &&
17 sane_unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL &&
18 git config user.name "test" &&
19 git config --global user.useConfigOnly true
22 test_expect_success
'fails committing if clone email is not set' '
23 test_must_fail git commit --allow-empty -m msg
26 test_expect_success
'fails committing if clone email is not set, but EMAIL set' '
27 test_must_fail env EMAIL=test@fail.com git commit --allow-empty -m msg
30 test_expect_success
'succeeds committing if clone email is set' '
31 test_config user.email "test@ok.com" &&
32 git commit --allow-empty -m msg
35 test_expect_success
'succeeds cloning if global email is not set' '