Use the final_oid_fn to finalize hashing of object IDs
[alt-git.git] / t / t7518-ident-corner-cases.sh
blob905957bd0a1681265f6064a65b319c1c3fa95484
1 #!/bin/sh
3 test_description='corner cases in ident strings'
4 . ./test-lib.sh
6 # confirm that we do not segfault _and_ that we do not say "(null)", as
7 # glibc systems will quietly handle our NULL pointer
9 # Note also that we can't use "env" here because we need to unset a variable,
10 # and "-u" is not portable.
11 test_expect_success 'empty name and missing email' '
13 sane_unset GIT_AUTHOR_EMAIL &&
14 GIT_AUTHOR_NAME= &&
15 test_must_fail git commit --allow-empty -m foo 2>err &&
16 test_i18ngrep ! "(null)" err
20 test_expect_success 'commit rejects all-crud name' '
21 test_must_fail env GIT_AUTHOR_NAME=" .;<>" \
22 git commit --allow-empty -m foo
25 # We must test the actual error message here, as an unwanted
26 # auto-detection could fail for other reasons.
27 test_expect_success 'empty configured name does not auto-detect' '
29 sane_unset GIT_AUTHOR_NAME &&
30 test_must_fail \
31 git -c user.name= commit --allow-empty -m foo 2>err &&
32 test_i18ngrep "empty ident name" err &&
33 test_i18ngrep "Author identity unknown" err
37 test_expect_success 'empty configured name does not auto-detect for committer' '
39 sane_unset GIT_COMMITTER_NAME &&
40 test_must_fail \
41 git -c user.name= commit --allow-empty -m foo 2>err &&
42 test_i18ngrep "empty ident name" err &&
43 test_i18ngrep "Committer identity unknown" err
47 test_done