Skip to content

Commit 6413d06

Browse files
nalladscho
authored andcommitted
git-wrapper: support git.exe and gitk.exe to be in a spaced dir
When *Git for Windows* is installed into a directory that has spaces in it, e.g. `C:\Program Files\Git`, the `git-wrapper` appends this directory unquoted when fixing up the command line. To resolve this, just quote the provided `execpath`. Signed-off-by: nalla <[email protected]>
1 parent afdbd9f commit 6413d06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/win32/git-wrapper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static LPWSTR fixup_commandline(LPWSTR exepath, LPWSTR *exep, int *wait,
133133
(wcslen(cmdline) + prefix_args_len + 1 + MAX_PATH));
134134
if (prefix_args) {
135135
if (is_git_command)
136-
_swprintf(cmd, L"%s\\%s %.*s", exepath, L"git.exe",
136+
_swprintf(cmd, L"\"%s\\%s\" %.*s", exepath, L"git.exe",
137137
prefix_args_len, prefix_args);
138138
else
139139
_swprintf(cmd, L"%.*s", prefix_args_len, prefix_args);
@@ -346,7 +346,7 @@ int main(void)
346346

347347
/* set the default exe module */
348348
wcscpy(exe, exepath);
349-
wcscpy(buffer, exepath);
349+
swprintf(buffer, BUFSIZE, L"\"%s\"", exepath);
350350
PathAppend(exe, msystem_bin);
351351
PathAppend(exe, L"wish.exe");
352352
if (_waccess(exe, 0) != -1)

0 commit comments

Comments
 (0)