mirror of
https://github.com/git/git.git
synced 2026-02-17 21:28:11 +00:00
squash! git-wrapper: serve as git-gui.exe, too
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.
This commit is contained in:
@@ -307,6 +307,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;
|
||||
|
||||
@@ -336,8 +362,7 @@ int main(void)
|
||||
PathAppend(exe, L"bin\\git.exe");
|
||||
}
|
||||
}
|
||||
else if (!wcscmp(basename, L"gitk.exe") ||
|
||||
!wcscmp(basename, L"git-gui.exe")) {
|
||||
else if (!wcscmp(basename, L"gitk.exe")) {
|
||||
static WCHAR buffer[BUFSIZE];
|
||||
if (!PathRemoveFileSpec(exepath)) {
|
||||
fwprintf(stderr,
|
||||
@@ -357,8 +382,7 @@ int main(void)
|
||||
PathAppend(exe, L"mingw\\bin\\wish.exe");
|
||||
PathAppend(buffer, L"mingw\\bin");
|
||||
}
|
||||
basename[wcslen(basename) - 4] = '\0';
|
||||
PathAppend(buffer, basename);
|
||||
PathAppend(buffer, L"gitk");
|
||||
prefix_args = buffer;
|
||||
prefix_args_len = wcslen(buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user