git-wrapper: serve as git-gui.exe, too

To avoid that ugly Console window when calling \cmd\git.exe gui...

To avoid confusion with builtins, we need to move the code block
handling gitk (and now git-gui, too) to intercept before git-gui is
mistaken for a builtin.

Unfortunately, git-gui is in libexec/git-core/ while gitk is in bin/,
therefore we need slightly more adjustments than just moving and
augmenting the gitk case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2015-04-02 11:23:34 +01:00
parent e949d01764
commit 944192580b

View File

@@ -304,6 +304,32 @@ int main(void)
&full_path, &skip_arguments)) {
/* do nothing */
}
else if (!wcscmp(basename, L"git-gui.exe")) {
static WCHAR buffer[BUFSIZE];
if (!PathRemoveFileSpec(exepath)) {
fwprintf(stderr,
L"Invalid executable path: %s\n", exepath);
ExitProcess(1);
}
/* set the default exe module */
wcscpy(exe, exepath);
PathAppend(exe, msystem_bin);
PathAppend(exe, L"wish.exe");
if (_waccess(exe, 0) != -1)
swprintf(buffer, BUFSIZE,
L"\"%s\\%.*s\\libexec\\git-core\"",
exepath, wcslen(msystem_bin) - 4, msystem_bin);
else {
wcscpy(exe, exepath);
PathAppend(exe, L"mingw\\bin\\wish.exe");
swprintf(buffer, BUFSIZE,
L"\"%s\\mingw\\libexec\\git-core\"", exepath);
}
PathAppend(buffer, L"git-gui");
prefix_args = buffer;
prefix_args_len = wcslen(buffer);
}
else if (!wcsncmp(basename, L"git-", 4)) {
needs_env_setup = 0;