Merge branch 'git-bash-wo-mintty'

This branch helps with installing a `git-bash.exe` that uses ConHost
(i.e. the default Windows console window) instead of MinTTY.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2015-05-07 15:27:45 +00:00

View File

@@ -187,9 +187,9 @@ static int strip_prefix(LPWSTR str, int *len, LPCWSTR prefix)
static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
LPWSTR *prefix_args, int *prefix_args_len,
int *is_git_command, LPWSTR *working_directory, int *full_path,
int *skip_arguments, int *allocate_console)
int *skip_arguments, int *allocate_console, int *show_console)
{
int id, minimal_search_path, needs_a_console, wargc;
int id, minimal_search_path, needs_a_console, no_hide, wargc;
LPWSTR *wargv;
#define BUFSIZE 65536
@@ -199,6 +199,7 @@ static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
for (id = 0; ; id++) {
minimal_search_path = 0;
needs_a_console = 0;
no_hide = 0;
len = LoadString(NULL, id, buf, BUFSIZE);
if (!len) {
@@ -221,6 +222,8 @@ static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
minimal_search_path = 1;
else if (strip_prefix(buf, &len, L"ALLOC_CONSOLE=1 "))
needs_a_console = 1;
else if (strip_prefix(buf, &len, L"SHOW_CONSOLE=1 "))
no_hide = 1;
else
break;
}
@@ -303,6 +306,8 @@ static int configure_via_resource(LPWSTR basename, LPWSTR exepath, LPWSTR exep,
*full_path = 0;
if (needs_a_console)
*allocate_console = 1;
if (no_hide)
*show_console = 1;
LocalFree(wargv);
return 1;
@@ -312,7 +317,7 @@ int main(void)
{
int r = 1, wait = 1, prefix_args_len = -1, needs_env_setup = 1,
is_git_command = 1, full_path = 1, skip_arguments = 0,
allocate_console = 0;
allocate_console = 0, show_console = 0;
WCHAR exepath[MAX_PATH], exe[MAX_PATH];
LPWSTR cmd = NULL, exep = exe, prefix_args = NULL, basename;
LPWSTR working_directory = NULL;
@@ -332,7 +337,8 @@ int main(void)
if (configure_via_resource(basename, exepath, exep,
&prefix_args, &prefix_args_len,
&is_git_command, &working_directory,
&full_path, &skip_arguments, &allocate_console)) {
&full_path, &skip_arguments, &allocate_console,
&show_console)) {
/* do nothing */
}
else if (!wcsicmp(basename, L"git-gui.exe")) {
@@ -462,6 +468,10 @@ int main(void)
creation_flags |= CREATE_NO_WINDOW;
}
if (show_console) {
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
}
br = CreateProcess(/* module: null means use command line */
exep,
cmd, /* modified command line */