On Wed, Jun 16, 2021 at 09:52:34AM +0900, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > >> So,... is contrib/subtree for Windows only? > > > > I read it as "this workaround is needed only on Windows, and will kick > > in only there; on other platforms, the "-ef" code will not run at all, > > so we don't have to worry about its portability". > > Yes, in the latest round that I queued yesterday, it is clear that > the use of non-POSIX "test" comes after the original condition > followed by "||", and even if "test" may sometimes be a builtin, I > do not think we will trigger an error at parse-time [*1*], so it is > a safe change. Yep, thanks for saying that last part out loud. > *1* I recall we had one interesting breakage of a script that tried > to do what is essentially: > > if are we running a shell with that funky feature? > then > shell commands that use the funky feature > else > portable POSIX shell feature > fi > > but the part that were supposed to be excluded from the > "portable" codepath by being between "then" and "else" still > were parsed and caused a parse error. IIRC, one instance was trying to redirect descriptors over 9. That works in bash but not elsewhere, but we ran into shells that choke on the parsing. So yeah, that is an important distinction in any portability workarounds. Sometimes an extra layer of "eval" can get around it, though. -Peff