git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Petr Onderka <gsvick@gmail.com>
Subject: [PATCH 3/3] tests: scrub environment of GIT_* variables
Date: Tue, 15 Mar 2011 02:04:45 -0500	[thread overview]
Message-ID: <20110315070445.GC29530@elie> (raw)
In-Reply-To: <20110315064909.GA25738@elie>

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 them in test-lib.

The variables to unset were found with 'git grep -F -e '"GIT_'.

Exception: leave the GIT_USE_LOOKUP variable from v1.5.6-rc0~134^2~1
(sha1-lookup: more memory efficient search in sorted list of SHA-1,
2007-12-29) alone, since it is about trying an alternate
implementation strategy rather than changing semantics and it can be
useful to compare performance with and without it set.

Longer term, it would be nice to just unset all GIT_* variables (with
exceptions like GIT_TRACE and GIT_USE_LOOKUP) with some magic using
the "env" command.  That is less straightforward than one might hope
because the values of environment variables can contain embedded
newlines and equal signs and "env -0" is not portable.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
IIRC the patch is based on v1.7.4.1.  So it does not handle
GIT_ASK_YESNO or GIT_TRACE_PACKET; they're too new.

Thanks for reading.  Hopefully it was not too dull.

 t/test-lib.sh |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8ae03c7..26c6707 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -43,7 +43,11 @@ TERM=dumb
 export LANG LC_ALL PAGER TERM TZ
 EDITOR=:
 unset VISUAL
+unset GIT_ASKPASS
 unset GIT_EDITOR
+unset GIT_PAGER
+unset GIT_MAN_VIEWER
+unset GIT_SSH
 unset AUTHOR_DATE
 unset AUTHOR_EMAIL
 unset AUTHOR_NAME
@@ -62,16 +66,43 @@ unset GIT_DIR
 unset GIT_WORK_TREE
 unset GIT_EXTERNAL_DIFF
 unset GIT_INDEX_FILE
+unset GIT_GRAFT_FILE
 unset GIT_OBJECT_DIRECTORY
 unset GIT_CEILING_DIRECTORIES
+unset GIT_DISCOVERY_ACROSS_FILESYSTEM
 unset SHA1_FILE_DIRECTORIES
 unset SHA1_FILE_DIRECTORY
+unset GIT_NO_REPLACE_OBJECTS
+unset GIT_CONFIG_PARAMETERS
 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_CURL_FTP_NO_EPSV
+unset GIT_CURL_VERBOSE
+unset GIT_PROJECT_ROOT
+unset GIT_PROXY_COMMAND
+unset GIT_HTTP_EXPORT_ALL
+unset GIT_HTTP_LOW_SPEED_LIMIT
+unset GIT_HTTP_LOW_SPEED_TIME
+unset GIT_HTTP_MAX_REQUESTS
+unset GIT_HTTP_USER_AGENT
+unset GIT_SSL_CAINFO
+unset GIT_SSL_CAPATH
+unset GIT_SSL_CERT
+unset GIT_SSL_CERT_PASSWORD_PROTECTED
+unset GIT_SSL_KEY
+unset GIT_SSL_NO_VERIFY
+unset GIT_FLUSH
+unset GIT_PAGER_IN_USE
+unset GIT_SEND_EMAIL_NOTTY
+unset GIT_DEBUG_LOOKUP
+unset GIT_DEBUG_SEND_PACK
+unset GIT_DEBUG_TESTGIT
+unset GIT_TRANSLOOP_DEBUG
+unset GIT_TRANSPORT_HELPER_DEBUG
 unset GIT_QUIET
 GIT_MERGE_VERBOSITY=5
 export GIT_MERGE_VERBOSITY
-- 
1.7.4.1

  parent reply	other threads:[~2011-03-15  7:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15  6:49 [PATCH 0/3] tests: unsetting variables that influence the outcome Jonathan Nieder
2011-03-15  6:56 ` [PATCH 1/3] tests: protect against GIT_ATTR_NOGLOBAL from environment Jonathan Nieder
2011-03-15  6:56 ` [PATCH 2/3] tests: suppress global and system gitattributes Jonathan Nieder
2011-03-15  7:16   ` Jeff King
2011-03-15  9:02     ` [PATCH 1-2/3 v2 0/3] " Jonathan Nieder
2011-03-15  9:04       ` [PATCH 1/3] gitattributes: drop support for GIT_ATTR_NOGLOBAL Jonathan Nieder
2011-03-15  9:04       ` [PATCH 2/3] config: drop support for GIT_CONFIG_NOGLOBAL Jonathan Nieder
2011-03-15  9:05       ` [PATCH 3/3] tests: suppress system gitattributes Jonathan Nieder
2011-03-15  7:04 ` Jonathan Nieder [this message]
2011-03-15  7:37   ` [PATCH 3/3] tests: scrub environment of GIT_* variables Jeff King
2011-03-15 10:08     ` [RFC/PATCH 0/2] tests: stop hard-coding the list of GIT_* vars to scrub Jonathan Nieder
2011-03-15 10:09       ` [PATCH 1/2] tests: stop worrying about obsolete environment variables Jonathan Nieder
2011-03-15 10:10       ` [RFC/PATCH 2/2] tests: scrub environment of GIT_* variables Jonathan Nieder
2011-03-15 17:20         ` Junio C Hamano
2011-03-15 20:01           ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110315070445.GC29530@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gsvick@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).