Hi Stephan.
Receipe
1. Open Windows command-line cmd.exe.
2. git status
Symptoms
The command-line is immediately closed.
Expected behaviour
Command-line is not closed after git commands.
Proposed change
In git.cmd replacing the line
exit %ErrorLevel%
by
exit /b %ErrorLevel%
seems to solve the problem.
Just a word of warning related to this...
We ran into a similar issue in one of our non-git related 'batch'
files where we actually had to leave the 'exit %ErrorLevel%' construct.
This was needed because the script got called using the 'cmd /c ...'
command and its return value would not propagate through the
intermediate cmd shell. As a workaround we now have two scripts - the
main worker one doing the 'exit %ErrorLevel%' that may be called using
the 'cmd /c ...' command and a wrapper one doing the 'exit /b
%ErrorLevel%' that calls the worker using the 'cmd /c ...' construct
that may be called directly from the command line.
Not sure if this use-case applies to git.cmd, but I hope it helps
someone...
Best regards,
Jurko Gospodnetić