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

Re: [PATCH 2/2] git-p4: remove bash-ism in t9800

From
Johannes Sixt <j6t@kdbg.org>
Date
Feb 26, 2012, 17:48 UTC
Message-ID
<4F4A7057.2020309@kdbg.org>
In-Reply-To
<1330270647-8817-3-git-send-email-pw@padd.com>
Am 26.02.2012 16:37, schrieb Pete Wyckoff:
Show 7 quoted lines
> -		P4EDITOR=touch P4USER=bob P4PASSWD=secret test_must_fail "$GITP4" commit --preserve-user &&
> -		test_must_fail git diff --exit-code HEAD..p4/master
> +		# dashism: test_must_fail does not propagate variables
> +		P4EDITOR=touch P4USER=bob P4PASSWD=secret &&
> +		export P4EDITOR P4USER P4PASSWD &&
> +		test_must_fail "$GITP4" commit --preserve-user &&
> +		! git diff --exit-code HEAD..p4/master

It is a bashism that variables assigned in front of a shell function are exported. But it is not a dashism that they are not exported; that (surprising?) behavior is actually conforming to POSIX.

With the new code, be aware that the variables remain exported, which might affect subsequent tests in general, though not this one, because the assignments are in a sub-shell:

>  	)
>  '
-- Hannes
Previous: Pete WyckoffNext: Pete Wyckoff
Message 4 of 5 in “git-p4: remove test bash-isms”
  1. 0/2 git-p4: remove test bash-ismsPete Wyckoff, Feb 26, 2012
  2. 1/2 git-p4: remove bash-ism in t9809Pete Wyckoff, Feb 26, 2012
  3. 2/2 git-p4: remove bash-ism in t9800Pete Wyckoff, Feb 26, 2012
  4. Johannes SixtFeb 26, 2012
  5. Pete WyckoffFeb 26, 2012

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.