mingw/msvc: use the new-style RUNTIME_PREFIX helper

This change also allows us to stop overriding argv[0] with the absolute path of the executable, allowing us to preserve e.g. the case of the executable's file name. This fixes https://github.com/git-for-windows/git/issues/1496 partially. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Apr 10, 2018 at 11:05 UTC 86e254584bb466aaf1bacbdf4a1ade924c8bdbe9
2 files changed +4 -3
compat/mingw.c
+2 -3
@@ -2221,7 +2221,7 @@ void mingw_startup(void)
2221 die_startup();
2222
2223 /* determine size of argv and environ conversion buffer */
2224 - maxlen = wcslen(_wpgmptr);
2224 + maxlen = wcslen(wargv[0]);
2225 for (i = 1; i < argc; i++)
2226 maxlen = max(maxlen, wcslen(wargv[i]));
2227 for (i = 0; wenv[i]; i++)
@@ -2241,8 +2241,7 @@ void mingw_startup(void)
2241 buffer = malloc_startup(maxlen);
2242
2243 /* convert command line arguments and environment to UTF-8 */
2244 - __argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
2245 - for (i = 1; i < argc; i++)
2244 + for (i = 0; i < argc; i++)
2245 __argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
2246 for (i = 0; wenv[i]; i++)
2247 environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);
config.mak.uname
+2
@@ -357,6 +357,7 @@ ifeq ($(uname_S),Windows)
357 SNPRINTF_RETURNS_BOGUS = YesPlease
358 NO_SVN_TESTS = YesPlease
359 RUNTIME_PREFIX = YesPlease
360 + HAVE_WPGMPTR = YesWeDo
361 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
362 NO_NSEC = YesPlease
363 USE_WIN32_MMAP = YesPlease
@@ -506,6 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
507 NO_SVN_TESTS = YesPlease
508 NO_PERL_MAKEMAKER = YesPlease
509 RUNTIME_PREFIX = YesPlease
510 + HAVE_WPGMPTR = YesWeDo
511 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
512 NO_NSEC = YesPlease
513 USE_WIN32_MMAP = YesPlease