Skip to content

Commit 378ebff

Browse files
authored
Merge pull request #1969 from rjvdboon/fix_1956
Improve LANG env var detection
2 parents 22aa59b + 572a94c commit 378ebff

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

vendor/init.bat

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,16 @@ if defined GIT_INSTALL_ROOT (
243243

244244
:: define SVN_SSH so we can use git svn with ssh svn repositories
245245
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
246-
247-
for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do (
248-
set "LANG=%%F"
246+
247+
if not defined LANG (
248+
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
249+
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe"
250+
if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F")
251+
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale
252+
if not defined git_locale set git_locale=env /usr/bin/locale
253+
for /F "delims=" %%F in ('!git_locale! -uU 2') do (
254+
set "LANG=%%F"
255+
)
249256
)
250257
)
251258

0 commit comments

Comments
 (0)