Skip to content

Commit bf1a7ff

Browse files
kbleeskusma
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]>
1 parent b115824 commit bf1a7ff

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

compat/mingw.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,12 @@ int mingw_offset_1st_component(const char *path)
18531853
return offset + is_dir_sep(path[offset]);
18541854
}
18551855

1856+
/*
1857+
* Disable MSVCRT command line wildcard expansion (__getmainargs called from
1858+
* mingw startup code, see init.c in mingw runtime).
1859+
*/
1860+
int _CRT_glob = 0;
1861+
18561862
void mingw_startup()
18571863
{
18581864
/* copy executable name to argv[0] */

0 commit comments

Comments
 (0)