git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: "Johannes Sixt" <j6t@kdbg.org>,
	"Mark Levedahl" <mlevedahl@gmail.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Patrick Steinhardt" <ps@pks.im>,
	"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH 5/5] git-gui: ensure own version of git-gui--askpass is used
Date: Wed, 30 Jul 2025 09:40:52 -0700	[thread overview]
Message-ID: <20250730164052.15371-6-carenas@gmail.com> (raw)
In-Reply-To: <20250730164052.15371-1-carenas@gmail.com>

Propagate the `git --exec-path` that is defined at build time
and use it when defining which askpass helper to use by default.

This is specially useful in macOS where a broken version of that
helper is provided by the system git.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 generate-git-gui.sh |  1 +
 git-gui.sh          | 10 +++++++++-
 lib/about.tcl       |  4 ++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/generate-git-gui.sh b/generate-git-gui.sh
index 39dfafd..f804686 100755
--- a/generate-git-gui.sh
+++ b/generate-git-gui.sh
@@ -22,6 +22,7 @@ sed \
 	-e "s|@@SHELL_PATH@@|$SHELL_PATH|" \
 	-e "1,30s|^ exec wish | exec '$TCLTK_PATH' |" \
 	-e "s|@@GITGUI_VERSION@@|$GITGUI_VERSION|g" \
+	-e "s|@@GITGUI_GITEXECDIR@@|$GITGUI_GITEXECDIR|" \
 	-e "s|@@GITGUI_RELATIVE@@|$GITGUI_RELATIVE|" \
 	-e "${GITGUI_RELATIVE}s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
 	"$INPUT" >"$OUTPUT"+
diff --git a/git-gui.sh b/git-gui.sh
index 8bb121d..9e6c152 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -364,6 +364,7 @@ set _isbare {}
 set _githtmldir {}
 set _reponame {}
 set _shellpath {@@SHELL_PATH@@}
+set _gitexecdir {@@GITGUI_GITEXECDIR@@}
 
 set _trace [lsearch -exact $argv --trace]
 if {$_trace >= 0} {
@@ -387,6 +388,13 @@ if {[string match @@* $_shellpath]} {
 	}
 }
 
+if {[string match @@* $_gitexecdir]} {
+	if {[catch {set _gitexecdir [exec git --exec-path]} err]} {
+		error "Git not installed?\n\n$err"
+	}
+	set _gitexecdir [file normalize $_gitexecdir]
+}
+
 if {[is_Windows]} {
 	set _shellpath [safe_exec [list cygpath -m $_shellpath]]
 }
@@ -1114,7 +1122,7 @@ citool {
 
 # Suggest our implementation of askpass, if none is set
 if {![info exists env(SSH_ASKPASS)]} {
-	set env(SSH_ASKPASS) [file join [git --exec-path] git-gui--askpass]
+	set env(SSH_ASKPASS) [file join $_gitexecdir git-gui--askpass]
 }
 
 ######################################################################
diff --git a/lib/about.tcl b/lib/about.tcl
index 122ebfb..d68e23b 100644
--- a/lib/about.tcl
+++ b/lib/about.tcl
@@ -2,7 +2,7 @@
 # Copyright (C) 2006, 2007 Shawn Pearce
 
 proc do_about {} {
-	global appvers copyright oguilib
+	global appvers copyright oguilib _gitexecdir
 	global tcl_patchLevel tk_patchLevel
 	global ui_comm_spell
 
@@ -44,7 +44,7 @@ proc do_about {} {
 
 	set d {}
 	append d "git wrapper: $::_git\n"
-	append d "git exec dir: [git --exec-path]\n"
+	append d "git exec dir: $_gitexecdir\n"
 	append d "git-gui lib: $oguilib"
 
 	paddedlabel $w.vers -text $v
-- 
2.50.1.475.g795bb014d8


  parent reply	other threads:[~2025-07-30 16:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 16:40 [PATCH 0/5] git-gui: workaround deprecation of Tcl/TK 8.5 in macOS Carlo Marcelo Arenas Belón
2025-07-30 16:40 ` [PATCH 1/5] git-gui: remove uname_O in Makefile Carlo Marcelo Arenas Belón
2025-07-30 20:07   ` Junio C Hamano
2025-07-30 16:40 ` [PATCH 2/5] git-gui: fix dependency of GITGUI_MAIN on generator Carlo Marcelo Arenas Belón
2025-07-30 16:40 ` [PATCH 3/5] git-gui: retire Git Gui.app Carlo Marcelo Arenas Belón
2025-07-30 16:40 ` [PATCH 4/5] git-gui: honor TCLTK_PATH in git-gui--askpass Carlo Marcelo Arenas Belón
2025-07-30 19:02   ` Johannes Sixt
2025-07-31 10:42     ` Patrick Steinhardt
2025-07-30 16:40 ` Carlo Marcelo Arenas Belón [this message]
2025-07-30 19:04   ` [PATCH 5/5] git-gui: ensure own version of git-gui--askpass is used Johannes Sixt
2025-07-30 21:19     ` Mark Levedahl
2025-07-30 19:09 ` [PATCH 0/5] git-gui: workaround deprecation of Tcl/TK 8.5 in macOS Johannes Sixt
2025-07-30 23:54   ` Carlo Arenas
2025-07-31 10:46     ` Patrick Steinhardt
2025-07-30 20:06 ` Junio C Hamano
2025-07-30 20:06 ` Junio C Hamano
2025-07-30 20:51   ` Carlo Arenas
2025-07-31  0:04     ` Junio C Hamano
2025-07-31  8:06 ` [PATCH v2 0/5] git-gui: workaround deprecation of Tcl/Tk " Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 1/5] git-gui: remove uname_O in Makefile Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 2/5] git-gui: fix dependency of GITGUI_MAIN on generator Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 3/5] git-gui: retire Git Gui.app Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 4/5] git-gui: honor TCLTK_PATH in git-gui--askpass Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 5/5] git-gui: ensure own version of git-gui--askpass is used Carlo Marcelo Arenas Belón
2025-07-31 17:47     ` Johannes Sixt

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=20250730164052.15371-6-carenas@gmail.com \
    --to=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=mlevedahl@gmail.com \
    --cc=ps@pks.im \
    /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).