[PATCH 5/5] git-gui: ensure own version of git-gui--askpass is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux