git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t7502-commit.sh: test_must_fail doesn't work with inline environment variables

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 19, 2008, 18:40 UTC
Message-ID
<7vd4mduv3t.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<gASAIyn4TvarEmVo9rWtEKa6eROfKXwowHxH6j05FzPARJ-CDBCHLw@cipher.nrlssc.navy.mil>
Brandon Casey <casey@nrlssc.navy.mil> writes:
Show 13 quoted lines
> 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"
 '
Previous: Brandon CaseyNext: Brandon Casey
Message 7 of 8 in “t7502-commit.sh: test_must_fail doesn't work with inline environment variables”
  1. t7502-commit.sh: test_must_fail doesn't work with inline environment variablesBrandon Casey, Jun 19, 2008
  2. Mike HommeyJun 19, 2008
  3. Brandon CaseyJun 19, 2008
  4. Mike HommeyJun 19, 2008
  5. Brandon CaseyJun 19, 2008
  6. Brandon CaseyJun 19, 2008
  7. Junio C HamanoJun 19, 2008
  8. Brandon CaseyJun 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.