On Mon, Nov 11, 2024 at 10:34:27AM +0900, Junio C Hamano wrote: > Phillip Wood <phillip.wood123@xxxxxxxxx> writes: > > > I've been using the CMake build in Visual Studio the last couple of days > > as my hard drive with linux on it died. I ended up with a slightly > > different fix using "sh -c" rather than putting the awk script inside > > a shell script. See the diff below. I don't have a strong preference > > either way but it would be nice to fix the line wrapping and add > > VERBATIM so that paths containing special characters are quoted correctly > > Thanks for comments. > > I've committed the same sin number of times, but a scriptlet written > in a third language as a string literal in a shell script is > somewhat awkward to maintain, so I may have slight preference for > your variant. Either way, we are now letting the shell, and not > CMake, to spawn "awk", so if that was the reason why the file needs > to be changed (i.e. CMake perhaps failed to or found a wrong awk), > either of your two approaches would solve that by delegating the > task to the shell. Yeah, I don't think it's particularly beautiful either. Personally, I'd still lean towards my solution, mostly because it allows us to iterate more readily in the future in case we ever need more logic in this context, and it avoids having to handle the redirect in the build system. So I'll take the VERBATIM and line wrapping suggestions, but for now keep the shell script. I'll adapt though if you think that this is too much of an abomination. Patrick