Merge branch 'mt/fix-add-rm-with-sparse-index'
[git/debian.git] / t / t7518-ident-corner-cases.sh
blobfffdb6ff2e751d2441e8f805c475a044bfdd0920
1 #!/bin/sh
3 test_description='corner cases in ident strings'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 # confirm that we do not segfault _and_ that we do not say "(null)", as
9 # glibc systems will quietly handle our NULL pointer
11 # Note also that we can't use "env" here because we need to unset a variable,
12 # and "-u" is not portable.
13 test_expect_success 'empty name and missing email' '
15 sane_unset GIT_AUTHOR_EMAIL &&
16 GIT_AUTHOR_NAME= &&
17 test_must_fail git commit --allow-empty -m foo 2>err &&
18 test_i18ngrep ! "(null)" err
22 test_expect_success 'commit rejects all-crud name' '
23 test_must_fail env GIT_AUTHOR_NAME=" .;<>" \
24 git commit --allow-empty -m foo
27 # We must test the actual error message here, as an unwanted
28 # auto-detection could fail for other reasons.
29 test_expect_success 'empty configured name does not auto-detect' '
31 sane_unset GIT_AUTHOR_NAME &&
32 test_must_fail \
33 git -c user.name= commit --allow-empty -m foo 2>err &&
34 test_i18ngrep "empty ident name" err &&
35 test_i18ngrep "Author identity unknown" err
39 test_expect_success 'empty configured name does not auto-detect for committer' '
41 sane_unset GIT_COMMITTER_NAME &&
42 test_must_fail \
43 git -c user.name= commit --allow-empty -m foo 2>err &&
44 test_i18ngrep "empty ident name" err &&
45 test_i18ngrep "Committer identity unknown" err
49 test_done