Re: [PATCH] test-lib: simplify '--option=value' parsing
- From
Jeff King <peff@peff.net>
- Date
- Apr 22, 2016, 18:37 UTC
- Message-ID
- <20160422183703.GA7595@sigill.intra.peff.net>
- In-Reply-To
- <1461339503-6854-1-git-send-email-szeder@ira.uka.de>
On Fri, Apr 22, 2016 at 05:38:23PM +0200, SZEDER Gábor wrote:
Show 6 quoted lines
> To get the 'value' from '--option=value', test-lib.sh parses said > option running 'expr' with a regexp. This involves a subshell, an > external process, and a lot of non-alphanumeric characters in the > regexp. > > Use a much simpler shell parameter expansion instead to do the same.
Looks OK to me. I doubt the extra process is a killer (we only parse options once per script), but the result is definitely more readable, IMHO.
For some reason I had always assumed that complicated pattern matching with "#" was non-POSIX, but I checked and it is definitely in there.
> --- > t/test-lib.sh | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-)
I count 5 cases in my copy of test-lib.sh. I think you are missing "--run".
-Peff