From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: "Jens Lehmann" <Jens.Lehmann@web.de>,
"Junio C Hamano" <gitster@pobox.com>,
"Git Mailing List" <git@vger.kernel.org>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH] squash! tests: fix overeager scrubbing of environment variables
Date: Mon, 28 Mar 2011 09:58:03 -0400 [thread overview]
Message-ID: <20110328135803.GA14763@sigill.intra.peff.net> (raw)
In-Reply-To: <20110327221753.GB27445@elie>
On Sun, Mar 27, 2011 at 05:17:53PM -0500, Jonathan Nieder wrote:
> How about something like this on top? Would it still be safe on
> platforms with ancient perl?
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> t/test-lib.sh | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 4a8c443..d28e647 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -46,7 +46,15 @@ unset VISUAL
> unset EMAIL
> unset $(perl -e '
> my @env = keys %ENV;
> - my @vars = grep(/^GIT_/ && !/^GIT_(TRACE|DEBUG|USE_LOOKUP|SKIP_TESTS|TEST|PROVE_OPTS)/, @env);
> + my @vars = grep(/^GIT_/ && !m{^GIT_(
> + TRACE |
> + DEBUG |
> + USE_LOOKUP |
> + TEST |
> + .*_TEST |
> + PROVE |
> + VALGRIND
> + )}x, @env);
I think that should be fine. The most exotic thing you use is /x. I
don't know when it was introduced, but perl5004delta refers to it as
something that was already around before then.
I think it might be a little more readable to get rid of the "|" on each
line like this:
my $ok = join("|", qw(
TRACE
DEBUG
USE_LOOKUP
TEST
.*_TEST
PROVE
VALGRIND
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o) @env;
which is a little simpler syntax, and makes patches nicer (you don't
have to add a trailing "|" on the line before). But that is a minor nit.
-Peff
next prev parent reply other threads:[~2011-03-28 13:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-27 21:22 [PATCH] tests: fix overeager scrubbing of environment variables Jens Lehmann
2011-03-27 21:37 ` Jonathan Nieder
2011-03-27 22:17 ` [PATCH] squash! " Jonathan Nieder
2011-03-28 13:58 ` Jeff King [this message]
2011-03-27 22:26 ` [PATCH v2] " Jens Lehmann
2011-03-27 23:00 ` [PATCH/RFC] tests: use the --long-tests facility to toggle some slow tests Jonathan Nieder
2011-03-28 17:00 ` [PATCH] tests: fix overeager scrubbing of environment variables Junio C Hamano
2011-03-28 19:16 ` [PATCH v3] " Jens Lehmann
2011-03-28 19:37 ` Jonathan Nieder
2011-03-28 21:03 ` Junio C Hamano
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=20110328135803.GA14763@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Jens.Lehmann@web.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
/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).