mirror of
https://github.com/git/git.git
synced 2026-02-03 06:21:39 +00:00
The quoting rules of `cmd.exe` are really, really quirky. In particular, if there are more than two quotes, the entire set of rules changes. That is the reason why CMD /C "C:\Program Files\Git\usr\bin\bash.exe" -l -i works, but CMD /C "C:\Program Files\Git\usr\bin\bash.exe" -l -i "test.sh" fails with this error message: 'C:\Program' is not recognized as an internal or external command, operable program or batch file. The recommended fix is to pass the /S option to `cmd.exe` and surround the entire command-line by an extra set of quotes. And here lies the rub: for that to work, we have to append an extra quote. At the end of the command-line. *After* the last argument was appended, if any. This commit supports that use case by introducing the option "APPEND_QUOTE". The intended usage is to use the following string resource: SHOW_CONSOLE=1 APPEND_QUOTE=1 @@COMSPEC@@ /S /C \"\"@@EXEPATH@@\\usr\\bin\\bash.exe\" --login -i (Note that there are only three quotes on that command-line, the fourth to be appended due to the `APPEND_QUOTE` setting.) This is (1/3) to fix https://github.com/git-for-windows/git/issues/396 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>