git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Klaeger via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Pratyush Yadav <me@yadavpratyush.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>,
	Thomas Klaeger <thklaeger@gmail.com>
Subject: [PATCH 1/1] git-gui (Windows): use git-bash.exe if it is available
Date: Thu, 26 Sep 2019 10:46:19 -0700 (PDT)	[thread overview]
Message-ID: <414cf2c89876fe122ee18f8d6533f083c2f65654.1569519977.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.360.git.gitgitgadget@gmail.com>

From: Thomas Klaeger <thklaeger@gmail.com>

Git for Windows 2.x ships with an executable that starts the Git Bash
with all the environment variables and what not properly set up. It is
also adjusted according to the Terminal emulator option chosen when
installing Git for Windows (while `bash.exe --login -i` would always
launch with Windows' default console).

So let's use that executable (usually C:\Program Files\Git\git-bash.exe)
instead of `bash.exe --login -i` if its presence was detected.

This fixes https://github.com/git-for-windows/git/issues/490

Signed-off-by: Thomas Kläger <thomas.klaeger@10a.ch>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index f9b323abff..5a1bfd736e 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2700,10 +2700,18 @@ if {![is_bare]} {
 }
 
 if {[is_Windows]} {
+	# Use /git-bash.exe if available
+	set normalized [file normalize $::argv0]
+	regsub "/mingw../libexec/git-core/git-gui$" \
+		$normalized "/git-bash.exe" cmdLine
+	if {$cmdLine != $normalized && [file exists $cmdLine]} {
+		set cmdLine [list "Git Bash" $cmdLine &]
+	} else {
+		set cmdLine [list "Git Bash" bash --login -l &]
+	}
 	.mbar.repository add command \
 		-label [mc "Git Bash"] \
-		-command {eval exec [auto_execok start] \
-					  [list "Git Bash" bash --login -l &]}
+		-command {eval exec [auto_execok start] $cmdLine}
 }
 
 if {[is_Windows] || ![is_bare]} {
-- 
gitgitgadget

  reply	other threads:[~2019-09-26 17:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 17:46 [PATCH 0/1] git-gui (Windows): use git-bash.exe if it is available Johannes Schindelin via GitGitGadget
2019-09-26 17:46 ` Thomas Klaeger via GitGitGadget [this message]
2019-09-26 21:57   ` [PATCH 1/1] " Pratyush Yadav
2019-09-30 10:27     ` Johannes Schindelin
2019-10-01  5:28       ` Johannes Sixt
2019-10-01 12:38       ` Pratyush Yadav
2019-10-01 13:46   ` Pratyush Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=414cf2c89876fe122ee18f8d6533f083c2f65654.1569519977.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=me@yadavpratyush.com \
    --cc=thklaeger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).