Re: [PATCH 2/2] git-p4: remove bash-ism in t9800
- From
- Pete Wyckoff <pw@padd.com>
- Date
- Feb 26, 2012, 18:16 UTC
- Message-ID
- <20120226181601.GA10130@padd.com>
- In-Reply-To
- <4F4A7057.2020309@kdbg.org>
j6t@kdbg.org wrote on Sun, 26 Feb 2012 18:48 +0100:
Show 19 quoted lines
> Am 26.02.2012 16:37, schrieb Pete Wyckoff: > > - 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: > > > ) > > '
Interesting, thanks. I thought about the subshell behavior and use, on purpose, the fact that the variables stay exported in the second and third hunks.
-- Pete