Re: [PATCH 01/18] rebase -i: Make the condition for an "if" more transparent

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paolo Bonzini
Date: Friday, January 15, 2010 - 12:20 am

On 01/14/2010 06:42 PM, Junio C Hamano wrote:

The reason for this is that the precedence rules were never well 
specified, and this made many sane-looking uses of "test -a/-o" problematic.

For example, if $x is "=", these work according to POSIX (it's not 
portable, but in practice it's okay):

   $ test -z "$x"
   $ test -z "$x" && test a = b

but this doesn't

   $ test -z "$x" -a a = b
   bash: test: too many arguments

because it groups "test -n = -a" and is left with "a = b".

Similarly, if $x is "-f", these

   $ test "$x"
   $ test "$x" || test c = d

correctly adds an implicit "-n", but this fails:

   $ test "$x" -o c = d
   bash: test: too many arguments

If anybody cleans up git's usage of test -a/-o, feel free to cut'n'paste 
the above into the commit messages.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/18] rebase -i: For pure fixups, do not start log ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 02/18] rebase -i: Remove dead code, Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 03/18] rebase -i: Inline expression, Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 05/18] rebase -i: Use symbolic constant $MSG consis ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 06/18] rebase -i: Document how temporary files are used, Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 07/18] rebase -i: Introduce a constant AUTHOR_SCRIPT, Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 08/18] rebase -i: Introduce a constant AMEND, Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 09/18] t3404: Test the commit count in commit messa ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 10/18] rebase -i: Improve consistency of commit cou ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 11/18] rebase -i: Simplify commit counting for gene ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 13/18] rebase -i: Handle the author script all in o ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 14/18] rebase -i: Extract function do_with_author, Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 15/18] rebase -i: Change function make_squash_messa ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 16/18] rebase -i: For fixup commands without squash ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
[PATCH 18/18] rebase -i: Retain user-edited commit message ..., Michael Haggerty, (Wed Jan 13, 10:54 pm)
Re: [PATCH 01/18] rebase -i: Make the condition for an & ..., Paolo Bonzini, (Fri Jan 15, 12:20 am)
Re: [PATCH 01/18] rebase -i: Make the condition for an "if ..., Johannes Schindelin, (Mon Jan 25, 11:28 am)
Re: [PATCH 00/18] rebase -i: For pure fixups, do not start ..., Johannes Schindelin, (Mon Jan 25, 11:38 am)