# [PATCH] tests: sanitize more git environment variables

4 messages from 2011-01-26 to 2011-01-27. Participants: Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/26341

## Jeff King, 2011-01-26 20:33

Subject: [PATCH] tests: sanitize more git environment variables
Message-ID: <20110126203331.GA27478@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110126203331.GA27478%40sigill.intra.peff.net

```
These variables should generally not be set in one's
environment, but they do get set by rebase, which means
doing an interactive rebase like:

  pick abcd1234 foo
  exec make test

will cause false negatives in the test suite.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/test-lib.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 42f2f14..0fdc541 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -70,6 +70,9 @@ 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
-- 
1.7.0.9.7.g36b59

```

## Jeff King, 2011-01-26 20:34

Subject: Re: [PATCH] tests: sanitize more git environment variables
Message-ID: <20110126203444.GB27478@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110126203444.GB27478%40sigill.intra.peff.net
In-Reply-To: <20110126203331.GA27478@sigill.intra.peff.net>

```
On Wed, Jan 26, 2011 at 03:33:32PM -0500, Jeff King wrote:

> These variables should generally not be set in one's
> environment, but they do get set by rebase, which means
> doing an interactive rebase like:
> 
>   pick abcd1234 foo
>   exec make test
> 
> will cause false negatives in the test suite.

Or I guess false positives, depending on your definition of positive and
negative. I.e., tests will fail when they shouldn't. :)

-Peff

```

## Junio C Hamano, 2011-01-26 20:43

Subject: Re: [PATCH] tests: sanitize more git environment variables
Message-ID: <7v39ofl7ki.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v39ofl7ki.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20110126203331.GA27478@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> These variables should generally not be set in one's
> environment, but they do get set by rebase, which means
> doing an interactive rebase like:
>
>   pick abcd1234 foo
>   exec make test
>
> will cause false negatives in the test suite.

Cute.  Thanks.

```

## Jeff King, 2011-01-27 00:31

Subject: Re: [PATCH] tests: sanitize more git environment variables
Message-ID: <20110127003136.GA5394@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110127003136.GA5394%40sigill.intra.peff.net
In-Reply-To: <7v39ofl7ki.fsf@alter.siamese.dyndns.org>

```
On Wed, Jan 26, 2011 at 12:43:25PM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > These variables should generally not be set in one's
> > environment, but they do get set by rebase, which means
> > doing an interactive rebase like:
> >
> >   pick abcd1234 foo
> >   exec make test
> >
> > will cause false negatives in the test suite.
> 
> Cute.  Thanks.

BTW, for anyone interested, I am using this with the following script:

-- >8 --
#!/bin/sh
upstream=`git rev-parse --symbolic-full-name "$1@{u}" >/dev/null 2>&1`
GIT_EDITOR='sed -i "/^pick .*/aexec make -j8 test"' \
	git rebase -i "${upstream:-origin}" $1
-- 8< --

which is a convenient way of testing each commit in a patch series
before submitting it upstream (and it stops on test failure so you can
fix up that commit).

You can drop it in your PATH as "git-test" and run "git test" or "git
test <branch>".

-Peff

```
