Skip to content

Commit 4527eda

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 b96b7d2 commit 4527eda

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
@@ -307,6 +307,32 @@ int main(void)
307307
&full_path, &skip_arguments)) {
308308
/* do nothing */
309309
}
310+
else if (!wcscmp(basename, L"git-gui.exe")) {
311+
static WCHAR buffer[BUFSIZE];
312+
if (!PathRemoveFileSpec(exepath)) {
313+
fwprintf(stderr,
314+
L"Invalid executable path: %s\n", exepath);
315+
ExitProcess(1);
316+
}
317+
318+
/* set the default exe module */
319+
wcscpy(exe, exepath);
320+
PathAppend(exe, msystem_bin);
321+
PathAppend(exe, L"wish.exe");
322+
if (_waccess(exe, 0) != -1)
323+
swprintf(buffer, BUFSIZE,
324+
L"\"%s\\%.*s\\libexec\\git-core\"",
325+
exepath, wcslen(msystem_bin) - 4, msystem_bin);
326+
else {
327+
wcscpy(exe, exepath);
328+
PathAppend(exe, L"mingw\\bin\\wish.exe");
329+
swprintf(buffer, BUFSIZE,
330+
L"\"%s\\mingw\\libexec\\git-core\"", exepath);
331+
}
332+
PathAppend(buffer, L"git-gui");
333+
prefix_args = buffer;
334+
prefix_args_len = wcslen(buffer);
335+
}
310336
else if (!wcsncmp(basename, L"git-", 4)) {
311337
needs_env_setup = 0;
312338

0 commit comments

Comments
 (0)