Browse Source

t7502: do not globally unset GIT_COMMITTER_* environment variables

One particular test wants to check the behaviour of the command
when these variables are not set, but the later tests should have
the reliable committer identity for repeatable tests.

Move the "unset" of the variables inside a subshell in the test
that wants to unset them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Junio C Hamano 17 years ago
parent
commit
7845944c64
  1. 9
      t/t7502-commit.sh

9
t/t7502-commit.sh

@ -171,13 +171,16 @@ sed '$d' < expect.tmp > expect
rm -f expect.tmp rm -f expect.tmp
echo "# Committer: echo "# Committer:
#" >> expect #" >> expect
unset GIT_COMMITTER_EMAIL
unset GIT_COMMITTER_NAME


test_expect_success 'committer is automatic' ' test_expect_success 'committer is automatic' '


echo >>negative && echo >>negative &&
git commit -e -m "sample" (
unset GIT_COMMITTER_EMAIL
unset GIT_COMMITTER_NAME
# must fail because there is no change
test_must_fail git commit -e -m "sample"
) &&
head -n 8 .git/COMMIT_EDITMSG | \ head -n 8 .git/COMMIT_EDITMSG | \
sed "s/^# Committer: .*/# Committer:/" >actual && sed "s/^# Committer: .*/# Committer:/" >actual &&
test_cmp expect actual test_cmp expect actual

Loading…
Cancel
Save