summaryrefslogtreecommitdiff
path: root/git-gui/git-gui.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-09-10 14:28:23 -0700
committerJunio C Hamano <gitster@pobox.com>2025-09-10 14:28:23 -0700
commitab427cd991100e94792fce124b0934135abdea4b (patch)
treef58047387847efb256ba62a0e121f2293ebd48d1 /git-gui/git-gui.sh
parentf2457a6f4ba4ae8078fa7559f6292786a287f696 (diff)
parent7ef77ec0054b3b4ef3cfee6ef97c43c01965be88 (diff)
Merge branch 'master' of https://github.com/j6t/git-gui
* 'master' of https://github.com/j6t/git-gui: git-gui: sync Makefiles with git.git git-gui: fix error handling of Revert Changes command git-gui--askyesno (mingw): use Git for Windows' icon, if available git-gui--askyesno: allow overriding the window title git gui: set GIT_ASKPASS=git-gui--askpass if not set yet git-gui: provide question helper for retry fallback on Windows git-gui: simplify using nice(1) git-gui: simplify PATH de-duplication
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-xgit-gui/git-gui.sh42
1 files changed, 14 insertions, 28 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index a931d7f7c9..d3d3aa14a9 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -103,7 +103,6 @@ if {[is_Windows]} {
set _path_sep {:}
}
-set _search_path {}
set _path_seen [dict create]
foreach p [split $env(PATH) $_path_sep] {
# Keep only absolute paths, getting rid of ., empty, etc.
@@ -112,12 +111,9 @@ foreach p [split $env(PATH) $_path_sep] {
}
# Keep only the first occurence of any duplicates.
set norm_p [file normalize $p]
- if {[dict exists $_path_seen $norm_p]} {
- continue
- }
dict set _path_seen $norm_p 1
- lappend _search_path $norm_p
}
+set _search_path [dict keys $_path_seen]
unset _path_seen
set env(PATH) [join $_search_path $_path_sep]
@@ -583,21 +579,6 @@ proc open_cmd_pipe {cmd path} {
return [open |$run r]
}
-proc _lappend_nice {cmd_var} {
- global _nice
- upvar $cmd_var cmd
-
- if {![info exists _nice]} {
- set _nice [_which nice]
- if {[catch {safe_exec [list $_nice git version]}]} {
- set _nice {}
- }
- }
- if {$_nice ne {}} {
- lappend cmd $_nice
- }
-}
-
proc git {args} {
git_redir $args {}
}
@@ -631,15 +612,14 @@ proc git_read {cmd {redir {}}} {
return [safe_open_command $cmdp $redir]
}
-proc git_read_nice {cmd} {
- global _git
- set opt [list]
-
- _lappend_nice opt
-
- set cmdp [concat [list $_git] $cmd]
+set _nice [list [_which nice]]
+if {[catch {safe_exec [list {*}$_nice git version]}]} {
+ set _nice {}
+}
- return [safe_open_command [concat $opt $cmdp]]
+proc git_read_nice {cmd} {
+ set cmdp [list {*}$::_nice $::_git {*}$cmd]
+ return [safe_open_command $cmdp]
}
proc git_write {cmd} {
@@ -1130,6 +1110,12 @@ set argv0dir [file dirname [file normalize $::argv0]]
if {![info exists env(SSH_ASKPASS)]} {
set env(SSH_ASKPASS) [file join $argv0dir git-gui--askpass]
}
+if {![info exists env(GIT_ASKPASS)]} {
+ set env(GIT_ASKPASS) [file join $argv0dir git-gui--askpass]
+}
+if {![info exists env(GIT_ASK_YESNO)]} {
+ set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
+}
unset argv0dir
######################################################################