You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git-wrapper: add code to configure command-lines to be launched
To allow the Git wrapper to replace the `git-bash.bat` script (which
would always open the Win32 console, even if the user wants to use a
different terminal emulator), we need to offer a way to configure
*which* command-line to run.
We need to recompile the git-wrapper with the `-mwindows` flag to
declare that this is a GUI program (not a console program). Having to
recompile it anyway, let's put the new code in a conditionally compiled
section so that the builtins (for which we use the git-wrapper, too) do
not need to carry around that code.
To configure the command-line, we use a way that is very typical for
Windows: resources. Windows resources are data that are stored inside
.exe files, but can be changed *after* compilation. Therefore, this
facility is *exactly* what we want: we can easily copy the .exe to the
new name `git-bash.exe`, configure that executable to run the Bash, and
then copy it again to the new name `git-cmd.exe` and configure that
executable to run `cmd.exe` instead.
For even more flexibility, we expand environment variables specified as
`@@<VARIABLE-NAME>@@`, and for convenience `@@EXEPATH@@` expands into
the directory in which the executable resides.
Sadly, an executable cannot configure itself: the `.exe` file is locked
while the process is running. This means we have to have a separate
executable to edit the resources anyway, so let's just enhance the Git
wrapper *itself*: when copied to the new name `edit-res.exe`, it can
edit other copies of the Git wrapper like so:
edit-res.exe git-cmd.exe command '@@comspec@@ /K'
Signed-off-by: Johannes Schindelin <[email protected]>
0 commit comments