mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
cf7a8515c6
Fix a couple of tests that would potentially fail under
GIT_TEST_FAIL_PREREQS=true.
I missed these when annotating other tests in dfe1a17df9
("tests: add
a special setup where prerequisites fail", 2019-05-13) because on my
system I can only reproduce this failure when I run the tests as
"root", since the tests happen to depend on whether we can fall back
on GECOS info or not. I.e. they'd usually fail to look up the ident
info anyway, but not always.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
49 lines
1.4 KiB
Bash
Executable file
49 lines
1.4 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='basic sanity checks for git var'
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'get GIT_AUTHOR_IDENT' '
|
|
test_tick &&
|
|
echo "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect &&
|
|
git var GIT_AUTHOR_IDENT >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'get GIT_COMMITTER_IDENT' '
|
|
test_tick &&
|
|
echo "$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" >expect &&
|
|
git var GIT_COMMITTER_IDENT >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success !FAIL_PREREQS,!AUTOIDENT 'requested identites are strict' '
|
|
(
|
|
sane_unset GIT_COMMITTER_NAME &&
|
|
sane_unset GIT_COMMITTER_EMAIL &&
|
|
test_must_fail git var GIT_COMMITTER_IDENT
|
|
)
|
|
'
|
|
|
|
# For git var -l, we check only a representative variable;
|
|
# testing the whole output would make our test too brittle with
|
|
# respect to unrelated changes in the test suite's environment.
|
|
test_expect_success 'git var -l lists variables' '
|
|
git var -l >actual &&
|
|
echo "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect &&
|
|
sed -n s/GIT_AUTHOR_IDENT=//p <actual >actual.author &&
|
|
test_cmp expect actual.author
|
|
'
|
|
|
|
test_expect_success 'git var -l lists config' '
|
|
git var -l >actual &&
|
|
echo false >expect &&
|
|
sed -n s/core\\.bare=//p <actual >actual.bare &&
|
|
test_cmp expect actual.bare
|
|
'
|
|
|
|
test_expect_success 'listing and asking for variables are exclusive' '
|
|
test_must_fail git var -l GIT_COMMITTER_IDENT
|
|
'
|
|
|
|
test_done
|