public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Michael Haggerty <mhagger@alum•mit.edu>
Cc: git@vger•kernel.org
Subject: [micro] Use 'env' on test_must_fail as appropriate
Date: Thu, 06 Mar 2014 17:14:31 -0800	[thread overview]
Message-ID: <xmqqfvmuvmh4.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqq1tyex6by.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Thu, 06 Mar 2014 15:20:17 -0800")

Because "VAR=VAL command" is sufficient to run 'command' with
environment variable VAR set to value VAL without affecting the
environment of the shell itself, but we cannot do the same with a
shell function (most notably, "test_must_fail"), we have subshell
invocations with multiple lines like this:

	... &&
	(
        	VAR=VAL &&
                export VAR &&
                test_must_fail git command
	) &&
        ...

which could be expressed as

	... &&
        test_must_fail env VAR=VAL git comand &&
	...

Find and shorten such constructs in existing test scripts.

Note that I am not 100% convinced myself that it is a good idea to
do this, so please do not add this to the list without seeing it
discussed.

Thanks.

      reply	other threads:[~2014-03-07  1:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 23:20 [PATCH] *.sh: drop useless use of "env" Junio C Hamano
2014-03-07  1:14 ` Junio C Hamano [this message]

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=xmqqfvmuvmh4.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=mhagger@alum$(echo .)mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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