Skip to content

Commit 5901dc6

Browse files
kbleesgitster
authored andcommitted
MinGW: disable CRT command line globbing
MingwRT listens to _CRT_glob to decide if __getmainargs should perform globbing, with the default being that it should. Unfortunately, __getmainargs globbing is sub-par; for instance patterns like "*.c" will only match c-sources in the current directory. Disable __getmainargs' command line wildcard expansion, so these patterns will be left untouched, and handled by Git's superior built-in globbing instead. MSVC defaults to no globbing, so we don't need to do anything in that case. This fixes t5505 and t7810. Signed-off-by: Karsten Blees <[email protected]> Signed-off-by: Erik Faye-Lund <[email protected]> Signed-off-by: Stepan Kasal <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 58aa3d2 commit 5901dc6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compat/mingw.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,12 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
19271927
return -1;
19281928
}
19291929

1930+
/*
1931+
* Disable MSVCRT command line wildcard expansion (__getmainargs called from
1932+
* mingw startup code, see init.c in mingw runtime).
1933+
*/
1934+
int _CRT_glob = 0;
1935+
19301936
void mingw_startup()
19311937
{
19321938
/* copy executable name to argv[0] */

0 commit comments

Comments
 (0)