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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brandon Casey <casey@xxxxxxxxxxxxxxx> 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"
 '
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux