diff options
Diffstat (limited to 'run-command.c')
| -rw-r--r-- | run-command.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/run-command.c b/run-command.c index d9f80fabe6..45ba544932 100644 --- a/run-command.c +++ b/run-command.c @@ -274,17 +274,24 @@ int sane_execvp(const char *file, char * const argv[]) return -1; } +char *git_shell_path(void) +{ +#ifndef GIT_WINDOWS_NATIVE + return xstrdup(SHELL_PATH); +#else + char *p = locate_in_PATH("sh"); + convert_slashes(p); + return p; +#endif +} + static const char **prepare_shell_cmd(struct strvec *out, const char **argv) { if (!argv[0]) BUG("shell command is empty"); if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) { -#ifndef GIT_WINDOWS_NATIVE - strvec_push(out, SHELL_PATH); -#else - strvec_push(out, "sh"); -#endif + strvec_push_nodup(out, git_shell_path()); strvec_push(out, "-c"); /* |
