Skip to content

Commit 9bd862a

Browse files
committed
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 <[email protected]>
1 parent b8d1965 commit 9bd862a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

compat/win32/git-wrapper.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,32 @@ int main(void)
304304
&full_path, &skip_arguments)) {
305305
/* do nothing */
306306
}
307+
else if (!wcscmp(basename, L"git-gui.exe")) {
308+
static WCHAR buffer[BUFSIZE];
309+
if (!PathRemoveFileSpec(exepath)) {
310+
fwprintf(stderr,
311+
L"Invalid executable path: %s\n", exepath);
312+
ExitProcess(1);
313+
}
314+
315+
/* set the default exe module */
316+
wcscpy(exe, exepath);
317+
PathAppend(exe, msystem_bin);
318+
PathAppend(exe, L"wish.exe");
319+
if (_waccess(exe, 0) != -1)
320+
swprintf(buffer, BUFSIZE,
321+
L"\"%s\\%.*s\\libexec\\git-core\"",
322+
exepath, wcslen(msystem_bin) - 4, msystem_bin);
323+
else {
324+
wcscpy(exe, exepath);
325+
PathAppend(exe, L"mingw\\bin\\wish.exe");
326+
swprintf(buffer, BUFSIZE,
327+
L"\"%s\\mingw\\libexec\\git-core\"", exepath);
328+
}
329+
PathAppend(buffer, L"git-gui");
330+
prefix_args = buffer;
331+
prefix_args_len = wcslen(buffer);
332+
}
307333
else if (!wcsncmp(basename, L"git-", 4)) {
308334
needs_env_setup = 0;
309335

0 commit comments

Comments
 (0)