On 2014-09-30 18:35, Junio C Hamano wrote: > Richard Hansen <rhansen@xxxxxxx> writes: >> * While this syntax works in both Bash and Zsh (assuming no >> pattern-special characters), my preference is to stick to POSIX[1] >> when possible. > > Nah. The existing script is full of bash-isms like local you > suggested to add (and other constructs like shell arrays and [[ ]] > tests, I suspect), True. > and there is no hope to "fix" them to stick to > the bare-minimum POSIX, I don't think it'd be hard to convert it to pure POSIX if there was a desire to do so. The biggest challenge would be 'local', which would require subshells or uniquified prefixed global variables. Both of those are likely to make the code a bit grotesque. > and there is no need to do so (isn't this > bash-prompt script after all?) It would be unwise to go to great lengths to avoid Bashisms, but I think it would be smart to use POSIX syntax when it is easy to do so. Rarely is it hard or awkward to use POSIX syntax ('local' and arrays are two major exceptions), so Bashisms like the ${//} expansion in this patch are usually unnecessary divergences from a ubiquitous standard. POSIX is a stable foundation, and it's easy to get POSIX shell code to run consistently on all POSIX-like shells. One of these days I'll try converting git-prompt.sh to POSIX -- I'm curious to see how bad it would be. -Richard -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html