Re: [PATCH 01/18] rebase -i: Make the condition for an "if" more transparent
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 14, 2010, 17:42 UTC
- Message-ID
- <7v8wc0fuqw.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <loom.20100114T164214-897@post.gmane.org>
Eric Blake <ebb9@byu.net> writes:
Show 7 quoted lines
> Michael Haggerty <mhagger <at> alum.mit.edu> writes: > >> current_sha1=$(git rev-parse --verify HEAD) >> - if test "$no_ff$current_sha1" = "$parent_sha1"; then >> + if test -z "$no_ff" -a "$current_sha1" = "$parent_sha1" > > 'test cond1 -a cond2' is not portable. Use 'test cond1 && test cond2'.
I avoid "test -a/-o" myself without even thinking (I am from old-school), but at the same time I thought the progress in the world made such caution obsolescent.
Not so. Even though POSIX.1 lists -a/-o as options to "test", they are marked "Obsolescent XSI" ("Strictly Conforming POSIX Applications and Strictly Conforming XSI Applications shall not use obsolescent features").
We may want [PATCH -01/18] to clean up the existing code first. Even outside git-rebase--interactive.sh there are quite a few of them.
$ git grep -n -e 'test .* -[ao] ' -- '*.sh' | wc -l
38