tvl-depot/third_party/git/t/t0007-git-var.sh
Vincent Ambo f4609b896f merge(3p/git): Merge git subtree at v2.29.2
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because
there is some breakage in the git build related to the netrc
credentials helper which someone has taken care of in nixpkgs.

The stable channel is not used for anything other than git, so this
should be fine.

Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
2020-11-21 19:45:56 +01:00

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 identities 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