threads / patch / 26341

patchtests: sanitize more git environment variables

Subject: [PATCH] tests: sanitize more git environment variables

## tl;dr

4 messages between Jan 26, 2011 and Jan 27, 2011. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Jeff King· Jan 26, 2011, 20:33 UTC · lore

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(-)
Show changes to t/test-lib.sh +3 −0
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· Jan 26, 2011, 20:34 UTC · re: Jeff King · lore

Re: [PATCH] tests: sanitize more git environment variables

On Wed, Jan 26, 2011 at 03:33:32PM -0500, Jeff King wrote:
Show 8 quoted lines
> 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· Jan 26, 2011, 20:43 UTC · re: Jeff King · lore

Re: [PATCH] tests: sanitize more git environment variables

Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> 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· Jan 27, 2011, 00:31 UTC · re: Junio C Hamano · lore

Re: [PATCH] tests: sanitize more git environment variables

On Wed, Jan 26, 2011 at 12:43:25PM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> 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

← back to recent threads