Re: [PATCH 5/5] git-gui: ensure own version of git-gui--askpass is used
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Jul 30, 2025, 19:04 UTC
- Message-ID
- <ce964e5a-fe30-42da-bf8d-969893e3907f@kdbg.org>
- In-Reply-To
- <20250730164052.15371-6-carenas@gmail.com>
Am 30.07.25 um 18:40 schrieb Carlo Marcelo Arenas Belón:
Show 8 quoted lines
> 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> > ---
This patch breaks Git GUI on builds with RUNTIME_PREFIX, I think, because it hard-codes the path to some exec-path that might not exist during runtime.
Show 35 quoted lines
> 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]} {We can't use [git --exec-path] here, because proc git is not defined, yet. Good.
> + error "Git not installed?\n\n$err"
We barely use 'error'. This is for developers, I would think, so it may be ok-ish. An alternative would be 'puts stderr ...' that we use elsewhere.
We must exit here, but 'error' doesn't do it for us. Insert 'exit 1'.
Show 35 quoted lines
> + }
> + 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"Nice touch to change this case as well!
> append d "git-gui lib: $oguilib" > > paddedlabel $w.vers -text $v
-- Hannes