Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Mike Hommey <mh@glandium.org>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] t7502-commit.sh: test_must_fail doesn't work with	inline environment variables
Date: Thu, 19 Jun 2008 11:40:06 -0700	[thread overview]
Message-ID: <7vd4mduv3t.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <gASAIyn4TvarEmVo9rWtEKa6eROfKXwowHxH6j05FzPARJ-CDBCHLw@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Thu, 19 Jun 2008 12:44:23 -0500")

Brandon Casey <casey@nrlssc.navy.mil> writes:

> Mike Hommey wrote:
>> On Thu, Jun 19, 2008 at 12:32:02PM -0500, Brandon Casey wrote:
>>> -	test_must_fail GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" git commit &&
>>> +	# We intentionally do not use test_must_fail on the next line since the
>>> +	# mechanism does not work when setting environment variables inline
>>> +	! GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" git commit &&
>> 
>> Doesn't GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" test_must_fail git commit
>> work ?
>
> That leaves GIT_EDITOR set to the new value after the command completes.
>
> -brandon

A Subshell?

@@ -212,6 +212,7 @@ test_expect_success 'do not fire
 	# Must fail due to conflict
 	test_must_fail git cherry-pick -n master &&
 	echo "editor not started" >.git/result &&
-	test_must_fail GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" git commit &&
+	( GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" && export GIT_EDITOR &&
+	  test_must_fail git commit ) &&
 	test "$(cat .git/result)" = "editor not started"
 '

  parent reply	other threads:[~2008-06-19 18:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 17:32 [PATCH] t7502-commit.sh: test_must_fail doesn't work with inline environment variables Brandon Casey
2008-06-19 17:39 ` Mike Hommey
2008-06-19 17:44   ` Brandon Casey
2008-06-19 17:56     ` Mike Hommey
2008-06-19 18:07       ` Brandon Casey
2008-06-19 18:12         ` Brandon Casey
2008-06-19 18:40     ` Junio C Hamano [this message]
2008-06-19 20:39       ` Brandon Casey

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=7vd4mduv3t.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=mh@glandium.org \
    /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