Try harder when looking for fixed issues
[msysgit/kusma.git] / cmd / git.cmd
blob27b91f09cf4f6c405d4edf1963f8077d5c544083
1 @rem Do not use "echo off" to not affect any child calls.
2 @setlocal
4 @rem Get the abolute path to the parent directory, which is assumed to be the
5 @rem Git installation root.
6 @for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
7 @set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
9 @if "%HOME%"=="" @set HOME=%USERPROFILE%
10 @set PLINK_PROTOCOL=ssh
12 @if "%1"=="gui" @goto gui
14 :default
15 @rem Get the current console ("OEM") codepage.
16 @for /f %%i in ('getcp -oem') do @set cp_oem=%%i
17 @rem Get the current GUI ("ANSI") codepage.
18 @for /f %%i in ('getcp -ansi') do @set cp_ansi=%%i
19 @rem Set the console codepage to match the GUI codepage.
20 @chcp %cp_ansi% > nul < nul
21 @git.exe %*
22 @set ErrorLevel=%ErrorLevel%
23 @rem Restore the original console codepage.
24 @chcp %cp_oem% > nul < nul
25 @goto quit
27 :gui
28 @if "%2"=="citool" @goto default
29 @for /f "tokens=1-1*" %%a in ("%*") do @set args=%%b
30 @start "git-gui" wish.exe "%git_install_root%\libexec\git-core\git-gui" -- %args%
32 :quit
33 @"%COMSPEC%" /c exit /b %ErrorLevel%