Skip to content

Commit 3819862

Browse files
committed
git: really allow specifying commands for git-cmd again
We looked for exactly one space after the quoted command, but we really want to allow an arbitrary number of spaces there. This should *really* fix git-for-windows/git#2039 once and for all. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent f33f7a1 commit 3819862

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mingw-w64-git/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ sha256sums=('SKIP'
6161
'62f455747f33953a723ff7b070d43f0ed03c1d8d0749d7bb06288e14d356b637'
6262
'f16b345aba17acd124ab5940635dfa2d87445df73eedbeb80e0285f29c85415a'
6363
'80b0b11efe5a2f9b4cd92f28c260d0b3aad8b809c34ed95237c59b73e08ade0b'
64-
'8b55ced53f2f11481d6019801c46b0708db40c1a8c7b024ecf308dc8012c6341'
64+
'541dcbf80eb0b72276ff7f91d689fa85fb5406cd9ff7a0c7de10de5baaba5c69'
6565
'ee0ed30b2601413a6efcd15f236747404cd2d576dcfad77fb5b1700852cde857'
6666
'a7e80489af33468e67a39d4c9c2fbf396e1f1e9533bb447f26432951ccf5e77c'
6767
'0726d386e98d703d5254458056e02824fb3de5602e55a31ec0cddf67c302c3a4'

mingw-w64-git/git-wrapper.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static LPWSTR fixup_commandline(LPWSTR exepath, LPWSTR *exep, int *wait,
249249
p++;
250250
}
251251

252-
if (*p == L' ' && p[1] == L'"' && space - cmd >= 8 &&
252+
if (*p == L' ' && p[wcsspn(p, L" ")] == L'"' && space - cmd >= 8 &&
253253
!wcsncmp(space - 8, L"\\cmd.exe /K \"", 13)) {
254254
/*
255255
* In git-cmd.exe, we automatically prepend a doskey
@@ -280,7 +280,9 @@ static LPWSTR fixup_commandline(LPWSTR exepath, LPWSTR *exep, int *wait,
280280
quote = cmd + wcslen(cmd) - 1;
281281
if (*quote == L'"')
282282
wcscpy(quote, L" && ");
283-
p += 2;
283+
while (*p == L' ')
284+
p++;
285+
p++;
284286
}
285287

286288
alloc += sizeof(WCHAR) * wcslen(p);

0 commit comments

Comments
 (0)