summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2012-04-17 09:03:21 +0200
committerJunio C Hamano <gitster@pobox.com>2012-04-17 08:51:54 -0700
commit776297548e27d18edbd582a3cda599bb619668a9 (patch)
tree7ef94acb505112e3dc8d5b024641f0535c13d698 /run-command.c
parentb3e34dddc0d385dbcf6ea28bd8d4f5cba9c06f04 (diff)
downloadgit-776297548e27d18edbd582a3cda599bb619668a9.tar.gz
Do not use SHELL_PATH from build system in prepare_shell_cmd on Windows
The recent change to use SHELL_PATH instead of "sh" to spawn shell commands is not suited for Windows: - The default setting, "/bin/sh", does not work when git has to run the shell because it is a POSIX style path, but not a proper Windows style path. - If it worked, it would hard-code a position in the files system where the shell is expected, making git (more precisely, the POSIX toolset that is needed alongside git) non-relocatable. But we cannot sacrifice relocatability on Windows. - Apart from that, even though the Makefile leaves SHELL_PATH set to "/bin/sh" for the Windows builds, the build system passes a mangled path to the compiler, and something like "D:/Src/msysgit/bin/sh" is used, which is doubly bad because it points to where /bin/sh resolves to on the system where git was built. - Finally, the system's CreateProcess() function that is used under mingw.c's hood does not work with forward slashes and cannot find the shell. Undo the earlier change on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c
index 2af3e0fa52..e4edede8b9 100644
--- a/run-command.c
+++ b/run-command.c
@@ -94,7 +94,11 @@ static const char **prepare_shell_cmd(const char **argv)
die("BUG: shell command is empty");
if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
+#ifndef WIN32
nargv[nargc++] = SHELL_PATH;
+#else
+ nargv[nargc++] = "sh";
+#endif
nargv[nargc++] = "-c";
if (argc < 2)