summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-03-15 05:10:45 -0500
committerJunio C Hamano <gitster@pobox.com>2011-03-15 12:23:57 -0700
commit95a1d12e9b9faddc02187ca28fdeb4fddd354c59 (patch)
treeb84c136f4c5d052de663c93b9e6e58c10230d7d4 /t/test-lib.sh
parent8f323c00dd3c9b396b01a1aeea74f7dfd061bb7f (diff)
downloadgit-95a1d12e9b9faddc02187ca28fdeb4fddd354c59.tar.gz
tests: scrub environment of GIT_* variables
Variables from the inherited environment that are meaningful to git can break tests in undesirable ways. For example, GIT_PAGER=more sh t5400-send-pack.sh -v -i hangs. So unset all environment variables in the GIT_ namespace in test-lib, with a few exceptions: - GIT_TRACE* are useful for tracking down bugs exhibited by a failing test; - GIT_DEBUG* are GIT_TRACE variables by another name, practically speaking. They should probably be tweaked to follow the GIT_TRACE_foo scheme and use trace_printf machinery some time. - GIT_USE_LOOKUP from v1.5.6-rc0~134^2~1 (sha1-lookup: more memory efficient search in sorted list of SHA-1, 2007-12-29) is about trying an alternate implementation strategy rather than changing semantics and it can be useful to compare performance with and without it set. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh23
1 files changed, 5 insertions, 18 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8893406969..8aac727fb2 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -43,29 +43,16 @@ TERM=dumb
export LANG LC_ALL PAGER TERM TZ
EDITOR=:
unset VISUAL
-unset GIT_EDITOR
unset EMAIL
-unset GIT_ALTERNATE_OBJECT_DIRECTORIES
-unset GIT_AUTHOR_DATE
+unset $(perl -e '
+ my @env = keys %ENV;
+ my @vars = grep(/^GIT_/ && !/^GIT_(TRACE|DEBUG|USE_LOOKUP)/, @env);
+ print join("\n", @vars);
+')
GIT_AUTHOR_EMAIL=author@example.com
GIT_AUTHOR_NAME='A U Thor'
-unset GIT_COMMITTER_DATE
GIT_COMMITTER_EMAIL=committer@example.com
GIT_COMMITTER_NAME='C O Mitter'
-unset GIT_DIFF_OPTS
-unset GIT_DIR
-unset GIT_WORK_TREE
-unset GIT_EXTERNAL_DIFF
-unset GIT_INDEX_FILE
-unset GIT_OBJECT_DIRECTORY
-unset GIT_CEILING_DIRECTORIES
-unset GIT_NOTES_REF
-unset GIT_NOTES_DISPLAY_REF
-unset GIT_NOTES_REWRITE_REF
-unset GIT_NOTES_REWRITE_MODE
-unset GIT_REFLOG_ACTION
-unset GIT_CHERRY_PICK_HELP
-unset GIT_QUIET
GIT_MERGE_VERBOSITY=5
export GIT_MERGE_VERBOSITY
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME