From d4fa9a6aef48ec9660de2be937418ec1d802aad4 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 10 Feb 2026 14:18:04 +0100 Subject: git-gui: massage "git-gui--askyesno" with "generate-script.sh" In e749c87 (git-gui: provide question helper for retry fallback on Windows, 2025-08-28) we have introudced a new "git-gui--askyesno" helper script. While the script is conceptually similar to our existing helper script "git-gui--askpass", we don't massage it via "generate-script.sh". This means that build options like the path to the wish shell are not propagated correctly. Fix this issue. Signed-off-by: Patrick Steinhardt --- .gitignore | 1 + Makefile | 7 ++++-- git-gui--askyesno | 63 ---------------------------------------------------- git-gui--askyesno.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 65 deletions(-) delete mode 100755 git-gui--askyesno create mode 100755 git-gui--askyesno.sh diff --git a/.gitignore b/.gitignore index 5130b4f018..38a41ebc58 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ GIT-GUI-BUILD-OPTIONS GIT-VERSION-FILE git-gui git-gui--askpass +git-gui--askyesno lib/tclIndex diff --git a/Makefile b/Makefile index 5679af62bd..ca01068810 100644 --- a/Makefile +++ b/Makefile @@ -177,10 +177,13 @@ GIT-GUI-BUILD-OPTIONS: FORCE git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh $(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS +git-gui--askyesno: git-gui--askyesno.sh GIT-GUI-BUILD-OPTIONS generate-script.sh + $(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS + ifdef GITGUI_WINDOWS_WRAPPER all:: git-gui endif -all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES) +all:: $(GITGUI_MAIN) git-gui--askpass git-gui--askyesno lib/tclIndex $(ALL_MSGFILES) install: all $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1) @@ -221,7 +224,7 @@ dist-version: GIT-VERSION-FILE @sed 's|^GITGUI_VERSION=||' $(TARDIR)/version clean:: - $(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE) + $(RM_RF) $(GITGUI_MAIN) git-gui--askpass git-gui--askyesno lib/tclIndex po/*.msg $(PO_TEMPLATE) $(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS ifdef GITGUI_WINDOWS_WRAPPER $(RM_RF) git-gui diff --git a/git-gui--askyesno b/git-gui--askyesno deleted file mode 100755 index 142d1bc3de..0000000000 --- a/git-gui--askyesno +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# Tcl ignores the next line -*- tcl -*- \ -exec wish "$0" -- "$@" - -# This is an implementation of a simple yes no dialog -# which is injected into the git commandline by git gui -# in case a yesno question needs to be answered. -# -# The window title, which defaults to "Question?", can be -# overridden via the optional `--title` command-line -# option. - -set NS {} -set use_ttk [package vsatisfies [package provide Tk] 8.5] -if {$use_ttk} { - set NS ttk -} - -set title "Question?" -if {$argc < 1} { - puts stderr "Usage: $argv0 " - exit 1 -} else { - if {$argc > 2 && [lindex $argv 0] == "--title"} { - set title [lindex $argv 1] - set argv [lreplace $argv 0 1] - } - set prompt [join $argv " "] -} - -${NS}::frame .t -${NS}::label .t.m -text $prompt -justify center -width 40 -.t.m configure -wraplength 400 -pack .t.m -side top -fill x -padx 20 -pady 20 -expand 1 -pack .t -side top -fill x -ipadx 20 -ipady 20 -expand 1 - -${NS}::frame .b -${NS}::frame .b.left -width 200 -${NS}::button .b.yes -text Yes -command {exit 0} -${NS}::button .b.no -text No -command {exit 1} - -pack .b.left -side left -expand 1 -fill x -pack .b.yes -side left -expand 1 -pack .b.no -side right -expand 1 -ipadx 5 -pack .b -side bottom -fill x -ipadx 20 -ipady 15 - -bind . {exit 0} -bind . {exit 1} - -if {$::tcl_platform(platform) eq {windows}} { - set icopath [file dirname [file normalize $argv0]] - if {[file tail $icopath] eq {git-core}} { - set icopath [file dirname $icopath] - } - set icopath [file dirname $icopath] - set icopath [file join $icopath share git git-for-windows.ico] - if {[file exists $icopath]} { - wm iconbitmap . -default $icopath - } -} - -wm title . $title -tk::PlaceWindow . diff --git a/git-gui--askyesno.sh b/git-gui--askyesno.sh new file mode 100755 index 0000000000..142d1bc3de --- /dev/null +++ b/git-gui--askyesno.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Tcl ignores the next line -*- tcl -*- \ +exec wish "$0" -- "$@" + +# This is an implementation of a simple yes no dialog +# which is injected into the git commandline by git gui +# in case a yesno question needs to be answered. +# +# The window title, which defaults to "Question?", can be +# overridden via the optional `--title` command-line +# option. + +set NS {} +set use_ttk [package vsatisfies [package provide Tk] 8.5] +if {$use_ttk} { + set NS ttk +} + +set title "Question?" +if {$argc < 1} { + puts stderr "Usage: $argv0 " + exit 1 +} else { + if {$argc > 2 && [lindex $argv 0] == "--title"} { + set title [lindex $argv 1] + set argv [lreplace $argv 0 1] + } + set prompt [join $argv " "] +} + +${NS}::frame .t +${NS}::label .t.m -text $prompt -justify center -width 40 +.t.m configure -wraplength 400 +pack .t.m -side top -fill x -padx 20 -pady 20 -expand 1 +pack .t -side top -fill x -ipadx 20 -ipady 20 -expand 1 + +${NS}::frame .b +${NS}::frame .b.left -width 200 +${NS}::button .b.yes -text Yes -command {exit 0} +${NS}::button .b.no -text No -command {exit 1} + +pack .b.left -side left -expand 1 -fill x +pack .b.yes -side left -expand 1 +pack .b.no -side right -expand 1 -ipadx 5 +pack .b -side bottom -fill x -ipadx 20 -ipady 15 + +bind . {exit 0} +bind . {exit 1} + +if {$::tcl_platform(platform) eq {windows}} { + set icopath [file dirname [file normalize $argv0]] + if {[file tail $icopath] eq {git-core}} { + set icopath [file dirname $icopath] + } + set icopath [file dirname $icopath] + set icopath [file join $icopath share git git-for-windows.ico] + if {[file exists $icopath]} { + wm iconbitmap . -default $icopath + } +} + +wm title . $title +tk::PlaceWindow . -- cgit v1.3