mirror of
https://github.com/git/git.git
synced 2026-03-13 18:33:25 +01:00
Fix invocation of external git commands with arguments with spaces.
If an external git command (not a shell script) was invoked with arguments
that contain spaces, these arguments would be split into separate
arguments. They must be quoted. This also affected installations where
$prefix contained a space, as in "C:\Program Files\GIT". Both errors can
be triggered by invoking
git hash-object "a b"
where "a b" is an existing file.
This commit is contained in:
committed by
Steffen Prohaska
parent
e66da1bb7b
commit
fbb7b31c45
@@ -298,7 +298,12 @@ void mingw_execve(const char *cmd, const char **argv, const char **env)
|
||||
{
|
||||
/* check if git_command is a shell script */
|
||||
if (!try_shell_exec(cmd, argv, env)) {
|
||||
int ret = spawnve(_P_WAIT, cmd, argv, env);
|
||||
const char **qargv;
|
||||
int n;
|
||||
for (n = 0; argv[n];) n++;
|
||||
qargv = xmalloc((n+1)*sizeof(char*));
|
||||
quote_argv(qargv, argv);
|
||||
int ret = spawnve(_P_WAIT, cmd, qargv, env);
|
||||
if (ret != -1)
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user