From: Junio C Hamano <gitster@pobox.com>
To: David Tran <unsignedzero@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v4] tests: use "env" to run commands with temporary env-var settings
Date: Thu, 20 Mar 2014 12:25:48 -0700 [thread overview]
Message-ID: <xmqqd2hgy8n7.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1395312670-1843-1-git-send-email-unsignedzero@gmail.com> (David Tran's message of "Thu, 20 Mar 2014 10:51:10 +0000")
David Tran <unsignedzero@gmail.com> writes:
> Ordinarily, we would say "VAR=VAL command" to execute a tested command with
> environment variable(s) set only for that command. This however does not work
> if 'command' is a shell function (most notably 'test_must_fail'); the result
> of the assignment is retained and affects later commands.
>
> To avoid this, we assigned and exported the environment variables and run such
> test(s) in a subshell like this,
>
> (
> VAR=VAL &&
> export VAR &&
> test_must_fail git command to be tested
> )
>
> Using the "env" utility, we should be able to say
>
> test_must_fail git command to be tested
>
> which is much shorter and easier to read.
>
> Signed-off-by: David Tran <unsignedzero@gmail.com>
>
> ---
> ...
>>Looks familiar ;-) but it seems the changes from the original you
>>took it from all look worsening, not improvements, to me.
> I learn more from rewriting than copying and pasting but I'll change most of it
> back then.
Sigh. Your edits again butchered the correctness.
Re-read your "this is a new and better way to write test_must_fail"
example above, and compare it with what was queued on 'pu'.
I think we are hitting the point of diminishing or negative returns
at this point. Let's keep 512477b1 (tests: use "env" to run
commands with temporary env-var settings, 2014-03-18) and go forward
with it.
Thanks.
prev parent reply other threads:[~2014-03-20 19:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 10:51 [PATCH v4] tests: use "env" to run commands with temporary env-var settings David Tran
2014-03-20 19:25 ` 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=xmqqd2hgy8n7.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=unsignedzero@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.