Re: [PATCH v2 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]

 



Am 31.07.25 um 10:06 schrieb Carlo Marcelo Arenas Belón:
> When finding a location for the askpass helper, git will be asked
> for its exec path, but if that git is not the same that called
> git-gui then we might mistakenly point to its helper instead.
> 
> Assume that git-gui and the helper are colocated to derive its
> path instead.
> 
> This is specially useful in macOS where a broken version of that
> helper is provided by the system git.
> 
> Suggested-by: Mark Levedahl <mlevedahl@xxxxxxxxx>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
> ---
>  git-gui.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/git-gui.sh b/git-gui.sh
> index 8bb121d..78324db 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -1114,7 +1114,9 @@ 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 [file dirname [file normalize $::argv0]] \
> +			git-gui--askpass]
>  }
>  
>  ######################################################################

FYI, in my integration branch, this area looks like so without this change:

# 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]
}
if {![info exists env(GIT_ASKPASS)]} {
	set env(GIT_ASKPASS) [file join [git --exec-path] git-gui--askpass]
}
if {![info exists env(GIT_ASK_YESNO)]} {
	set env(GIT_ASK_YESNO) [file join [git --exec-path] git-gui--askyesno]
}

To help these other cases, I'll squash the following into this
commit:

diff --git a/git-gui.sh b/git-gui.sh
index 78324db2b587..f28a23f844cf 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1113,11 +1113,11 @@ citool {
 ## execution environment
 
 # Suggest our implementation of askpass, if none is set
+set argv0dir [file dirname [file normalize $::argv0]]
 if {![info exists env(SSH_ASKPASS)]} {
-	set env(SSH_ASKPASS) \
-		[file join [file dirname [file normalize $::argv0]] \
-			git-gui--askpass]
+	set env(SSH_ASKPASS) [file join $argv0dir git-gui--askpass]
 }
+unset argv0dir
 
 ######################################################################
 ##






[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