mirror of
https://github.com/git/git.git
synced 2024-12-12 03:14:11 +08:00
6789275d37
They are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite test_i18ngrep to test_grep, there won't be any new bug, even if there still are callers of test_i18ngrep remaining in the tree, or when merged to other topics that add new uses of test_i18ngrep. This patch was produced more or less with git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /' and a good way to sanity check the result yourself is to run the above in a checkout of c4603c1c (test framework: further deprecate test_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see that test_i18ngrep in a few t/lib-*.sh files corrected, in addition to the manual reproduction. Signed-off-by: Junio C Hamano <gitster@pobox.com>
59 lines
1.6 KiB
Bash
Executable File
59 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='corner cases in ident strings'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
# confirm that we do not segfault _and_ that we do not say "(null)", as
|
|
# glibc systems will quietly handle our NULL pointer
|
|
#
|
|
# Note also that we can't use "env" here because we need to unset a variable,
|
|
# and "-u" is not portable.
|
|
test_expect_success 'empty name and missing email' '
|
|
(
|
|
sane_unset GIT_AUTHOR_EMAIL &&
|
|
GIT_AUTHOR_NAME= &&
|
|
test_must_fail git commit --allow-empty -m foo 2>err &&
|
|
test_grep ! "(null)" err
|
|
)
|
|
'
|
|
|
|
test_expect_success 'commit rejects all-crud name' '
|
|
test_must_fail env GIT_AUTHOR_NAME=" ,;<>" \
|
|
git commit --allow-empty -m foo
|
|
'
|
|
|
|
test_expect_success 'commit does not strip trailing dot' '
|
|
author_name="Pat Doe Jr." &&
|
|
env GIT_AUTHOR_NAME="$author_name" \
|
|
git commit --allow-empty -m foo &&
|
|
git log -1 --format=%an >actual &&
|
|
echo "$author_name" >expected &&
|
|
test_cmp actual expected
|
|
'
|
|
|
|
# We must test the actual error message here, as an unwanted
|
|
# auto-detection could fail for other reasons.
|
|
test_expect_success 'empty configured name does not auto-detect' '
|
|
(
|
|
sane_unset GIT_AUTHOR_NAME &&
|
|
test_must_fail \
|
|
git -c user.name= commit --allow-empty -m foo 2>err &&
|
|
test_grep "empty ident name" err &&
|
|
test_grep "Author identity unknown" err
|
|
)
|
|
'
|
|
|
|
test_expect_success 'empty configured name does not auto-detect for committer' '
|
|
(
|
|
sane_unset GIT_COMMITTER_NAME &&
|
|
test_must_fail \
|
|
git -c user.name= commit --allow-empty -m foo 2>err &&
|
|
test_grep "empty ident name" err &&
|
|
test_grep "Committer identity unknown" err
|
|
)
|
|
'
|
|
|
|
test_done
|