On Fri, May 13, 2016 at 03:59:11PM -0400, Jeff King wrote: > On Fri, May 13, 2016 at 12:52:44PM -0700, Junio C Hamano wrote: > > > I _think_ "test -z" should succeed according to POSIX, because > > > > (1) it is not "test -z string" because it lacks string, > > > > (2) it is not any of the other "test -<option> thing" because -z, > > and > > > > (3) the only thing it matches in the supported form of "test" is > > "test <string>" that tests if the <string> is not the null > > string, and "-z" indeed is not the null string. > > > > For the same reason, "test -n" succeeds. > > Yeah, I think you're right; POSIX is pretty clear that this falls under > case 3. So that means "test -z" quietly does what we want. But it means > that "test -n" does the _opposite_ of what we want. > > And sadly, > > git grep 'test -n [^"]' > > is not empty. > > > But working around older/broken shells is easy and the resulting > > script it more readable, so let's take this. It makes the resulting > > code easier to understand even when we know we run it under POSIX > > shell. > > Yep. The POSIX-explanation of what is going on might be worth putting in > the commit message for the "-z" case (i.e., it should work, but the > "why" is subtle).
I think we can just lump all of these into a single patch, but there are a few related cleanups, including the SVN stuff I just sent. So let me send out a unified patch series in a moment. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html