# [PATCH 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows

19 messages from 2019-09-26 to 2025-11-17. Participants: Johannes Schindelin via GitGitGadget, Heiko Voigt via GitGitGadget, Pratyush Yadav, Mark Levedahl, Johannes Schindelin, Johannes Sixt.
Thread: https://gitlist.dev/t/51926

## Johannes Schindelin via GitGitGadget, 2019-09-26 15:29

Subject: [PATCH 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows
Message-ID: <pull.358.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.358.git.gitgitgadget%40gmail.com

```
This is another set of patches from Git for Windows' fork that have been
sitting there since 2010, providing cross-platform GUI helpers to ask the
user a question or allow typing in a password.

This patch series was first submitted as 
https://github.com/patthoyts/git-gui/pull/5 which was ignored for almost
three years, then re-submitted as 
https://github.com/prati0100/git-gui/pull/3 which was rejected in favor of a
contribution by mail.

The patches are based on Git GUI's master branch at 
https://github.com/prati0100/git-gui/.

Heiko Voigt (1):
  git-gui: provide question helper for retry fallback on Windows

Johannes Schindelin (3):
  git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
  git-gui--askyesno: allow overriding the window title
  git-gui--askyesno (mingw): use Git for Windows' icon, if available

 Makefile          |  2 ++
 git-gui--askyesno | 68 +++++++++++++++++++++++++++++++++++++++++++++++
 git-gui.sh        |  6 +++++
 3 files changed, 76 insertions(+)
 create mode 100755 git-gui--askyesno


base-commit: 12d29c326551a6570594db525bea42ad9cea8028
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-358%2Fdscho%2Fgit-gui-askpass-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-358/dscho/git-gui-askpass-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/358
-- 
gitgitgadget

```

## Heiko Voigt via GitGitGadget, 2019-09-26 15:29

Subject: [PATCH 1/4] git-gui: provide question helper for retry fallback on Windows
Message-ID: <58972068a230c996951e26d795e26cf66459c497.1569511793.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/58972068a230c996951e26d795e26cf66459c497.1569511793.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.git.gitgitgadget@gmail.com>

```
From: Heiko Voigt <hvoigt@hvoigt.net>

Make use of the new environment variable GIT_ASK_YESNO to support the
recently implemented fallback in case unlink, rename or rmdir fail for
files in use on Windows. The added dialog will present a yes/no question
to the the user which will currently be used by the windows compat layer
to let the user retry a failed file operation.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile          |  2 ++
 git-gui--askyesno | 51 +++++++++++++++++++++++++++++++++++++++++++++++
 git-gui.sh        |  3 +++
 3 files changed, 56 insertions(+)
 create mode 100755 git-gui--askyesno

diff --git a/Makefile b/Makefile
index fe30be38dc..85633b73df 100644
--- a/Makefile
+++ b/Makefile
@@ -291,6 +291,7 @@ install: all
 	$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
 	$(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(QUIET)$(INSTALL_X0)git-gui--askpass $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
+	$(QUIET)$(INSTALL_X0)git-gui--askyesno $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true
 ifdef GITGUI_WINDOWS_WRAPPER
 	$(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
@@ -309,6 +310,7 @@ uninstall:
 	$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
 	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askpass $(REMOVE_F1)
+	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askyesno $(REMOVE_F1)
 	$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
 ifdef GITGUI_WINDOWS_WRAPPER
 	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)
diff --git a/git-gui--askyesno b/git-gui--askyesno
new file mode 100755
index 0000000000..cf9c990d09
--- /dev/null
+++ b/git-gui--askyesno
@@ -0,0 +1,51 @@
+#!/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.
+
+set NS {}
+set use_ttk [package vsatisfies [package provide Tk] 8.5]
+if {$use_ttk} {
+	set NS ttk
+}
+
+if {$argc < 1} {
+	puts stderr "Usage: $argv0 <question>"
+	exit 1
+} else {
+	set prompt [join $argv " "]
+}
+
+${NS}::frame .t
+${NS}::label .t.m -text $prompt -justify center -width 400px
+.t.m configure -wraplength 400px
+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 yes
+${NS}::button .b.no  -text No  -command no
+
+
+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 . <Key-Return> {exit 0}
+bind . <Key-Escape> {exit 1}
+
+proc no {} {
+	exit 1
+}
+
+proc yes {} {
+	exit 0
+}
+
+wm title . "Question?"
+tk::PlaceWindow .
diff --git a/git-gui.sh b/git-gui.sh
index f9b323abff..76d8139b8d 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1248,6 +1248,9 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
 if {![info exists env(SSH_ASKPASS)]} {
 	set env(SSH_ASKPASS) [gitexec git-gui--askpass]
 }
+if {![info exists env(GIT_ASK_YESNO)]} {
+	set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
+}
 
 ######################################################################
 ##
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2019-09-26 15:29

Subject: [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Message-ID: <cb9f8c8158c5a7b55ed746234624ae69a575f608.1569511793.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/cb9f8c8158c5a7b55ed746234624ae69a575f608.1569511793.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.git.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/git-gui.sh b/git-gui.sh
index 76d8139b8d..66f046a0c7 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1248,6 +1248,9 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
 if {![info exists env(SSH_ASKPASS)]} {
 	set env(SSH_ASKPASS) [gitexec git-gui--askpass]
 }
+if {![info exists env(GIT_ASKPASS)]} {
+	set env(GIT_ASKPASS) [gitexec git-gui--askpass]
+}
 if {![info exists env(GIT_ASK_YESNO)]} {
 	set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
 }
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2019-09-26 15:29

Subject: [PATCH 3/4] git-gui--askyesno: allow overriding the window title
Message-ID: <8cfc935cdba316f513f2408c1f39c5d68d5258fc.1569511793.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/8cfc935cdba316f513f2408c1f39c5d68d5258fc.1569511793.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.git.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

"Question?" is maybe not the most informative thing to ask. In the
absence of better information, it is the best we can do, of course.

However, Git for Windows' auto updater just learned the trick to use
git-gui--askyesno to ask the user whether to update now or not. And in
this scripted scenario, we can easily pass a command-line option to
change the window title.

So let's support that with the new `--title <title>` option.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui--askyesno | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/git-gui--askyesno b/git-gui--askyesno
index cf9c990d09..45b0260eff 100755
--- a/git-gui--askyesno
+++ b/git-gui--askyesno
@@ -12,10 +12,15 @@ if {$use_ttk} {
 	set NS ttk
 }
 
+set title "Question?"
 if {$argc < 1} {
 	puts stderr "Usage: $argv0 <question>"
 	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 " "]
 }
 
@@ -47,5 +52,5 @@ proc yes {} {
 	exit 0
 }
 
-wm title . "Question?"
+wm title . $title
 tk::PlaceWindow .
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2019-09-26 15:30

Subject: [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available
Message-ID: <6025b38d2659caa111d2e5e9a1fa48d47de0e827.1569511793.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/6025b38d2659caa111d2e5e9a1fa48d47de0e827.1569511793.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.git.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

For additional GUI goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui--askyesno | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/git-gui--askyesno b/git-gui--askyesno
index 45b0260eff..c0c82e7cbd 100755
--- a/git-gui--askyesno
+++ b/git-gui--askyesno
@@ -52,5 +52,17 @@ proc yes {} {
 	exit 0
 }
 
+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 .
-- 
gitgitgadget

```

## Pratyush Yadav, 2019-09-29 17:11

Subject: Re: [PATCH 1/4] git-gui: provide question helper for retry fallback on Windows
Message-ID: <20190929171129.u5kvx5ggyjxjkzdu@yadavpratyush.com>
URL: https://gitlist.dev/e/20190929171129.u5kvx5ggyjxjkzdu%40yadavpratyush.com
In-Reply-To: <58972068a230c996951e26d795e26cf66459c497.1569511793.git.gitgitgadget@gmail.com>

```
On 26/09/19 08:29AM, Heiko Voigt via GitGitGadget wrote:
> From: Heiko Voigt <hvoigt@hvoigt.net>
> 
> Make use of the new environment variable GIT_ASK_YESNO to support the
> recently implemented fallback in case unlink, rename or rmdir fail for
> files in use on Windows. The added dialog will present a yes/no question
> to the the user which will currently be used by the windows compat layer
> to let the user retry a failed file operation.

I can't find any documentation related to this environment variable. A 
Google search does not yield any promising results. I don't see this 
mentioned in the git man page either, though that is to be expected 
because it seems to be a Windows-only variable.

My point is, it would be nice if the commit message pointed to some sort 
of documentation for the environment variable. It would also help me in 
reviewing the patch if I know more about the variable.

Either way, some minor comments down below.

> 
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  Makefile          |  2 ++
>  git-gui--askyesno | 51 +++++++++++++++++++++++++++++++++++++++++++++++
>  git-gui.sh        |  3 +++
>  3 files changed, 56 insertions(+)
>  create mode 100755 git-gui--askyesno
> 
> diff --git a/Makefile b/Makefile
> index fe30be38dc..85633b73df 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -291,6 +291,7 @@ install: all
>  	$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
>  	$(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
>  	$(QUIET)$(INSTALL_X0)git-gui--askpass $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
> +	$(QUIET)$(INSTALL_X0)git-gui--askyesno $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
>  	$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true
>  ifdef GITGUI_WINDOWS_WRAPPER
>  	$(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
> @@ -309,6 +310,7 @@ uninstall:
>  	$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
>  	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
>  	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askpass $(REMOVE_F1)
> +	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askyesno $(REMOVE_F1)
>  	$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
>  ifdef GITGUI_WINDOWS_WRAPPER
>  	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)

I'm not too slick with Makefiles, but these changes look good.

> diff --git a/git-gui--askyesno b/git-gui--askyesno
> new file mode 100755
> index 0000000000..cf9c990d09
> --- /dev/null
> +++ b/git-gui--askyesno
> @@ -0,0 +1,51 @@
> +#!/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.
> +
> +set NS {}
> +set use_ttk [package vsatisfies [package provide Tk] 8.5]
> +if {$use_ttk} {
> +	set NS ttk
> +}
> +
> +if {$argc < 1} {
> +	puts stderr "Usage: $argv0 <question>"
> +	exit 1
> +} else {
> +	set prompt [join $argv " "]
> +}
> +
> +${NS}::frame .t
> +${NS}::label .t.m -text $prompt -justify center -width 400px
> +.t.m configure -wraplength 400px
> +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 yes
> +${NS}::button .b.no  -text No  -command no

Do you really need separate functions for yes/no? I think something like

  -command {exit 1}

and

  -command {exit 0}

would do just fine.

Either way...

> +
> +

Nitpick: Drop one of the two blank lines.

> +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 . <Key-Return> {exit 0}
> +bind . <Key-Escape> {exit 1}

... do the same thing here. Call yes and no here too if you are using 
them above.

I have no preference for either way, but I would like uniformity in 
these two spots.

> +
> +proc no {} {
> +	exit 1
> +}
> +
> +proc yes {} {
> +	exit 0
> +}
> +
> +wm title . "Question?"
> +tk::PlaceWindow .
> diff --git a/git-gui.sh b/git-gui.sh
> index f9b323abff..76d8139b8d 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -1248,6 +1248,9 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
>  if {![info exists env(SSH_ASKPASS)]} {
>  	set env(SSH_ASKPASS) [gitexec git-gui--askpass]
>  }
> +if {![info exists env(GIT_ASK_YESNO)]} {
> +	set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
> +}

Since this seems to be a Windows-only variable, you might want to enable 
it only on Windows. Are there workflows on other platforms that would 
use this environment variable?

-- 
Regards,
Pratyush Yadav

```

## Pratyush Yadav, 2019-09-29 17:15

Subject: Re: [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Message-ID: <20190929171537.3t5f5glq2jamkpa5@yadavpratyush.com>
URL: https://gitlist.dev/e/20190929171537.3t5f5glq2jamkpa5%40yadavpratyush.com
In-Reply-To: <cb9f8c8158c5a7b55ed746234624ae69a575f608.1569511793.git.gitgitgadget@gmail.com>

```
What is the difference between SSH_ASKPASS and GIT_ASKPASS? On my first 
read, I assumed SSH_ASKPASS is replaced by GIT_ASKPASS, but I might be 
wrong.

On 26/09/19 08:29AM, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  git-gui.sh | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/git-gui.sh b/git-gui.sh
> index 76d8139b8d..66f046a0c7 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -1248,6 +1248,9 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
>  if {![info exists env(SSH_ASKPASS)]} {
>  	set env(SSH_ASKPASS) [gitexec git-gui--askpass]
>  }
> +if {![info exists env(GIT_ASKPASS)]} {
> +	set env(GIT_ASKPASS) [gitexec git-gui--askpass]
> +}
>  if {![info exists env(GIT_ASK_YESNO)]} {
>  	set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
>  }

-- 
Regards,
Pratyush Yadav

```

## Pratyush Yadav, 2019-09-29 17:31

Subject: Re: [PATCH 3/4] git-gui--askyesno: allow overriding the window title
Message-ID: <20190929173135.3swz2canehtoxkcf@yadavpratyush.com>
URL: https://gitlist.dev/e/20190929173135.3swz2canehtoxkcf%40yadavpratyush.com
In-Reply-To: <8cfc935cdba316f513f2408c1f39c5d68d5258fc.1569511793.git.gitgitgadget@gmail.com>

```
One minor nitpick: please add a comment at the top of the file 
documenting the `--title` option, and the usage of the program in 
general.

Other than that, looks good. Thanks.

On 26/09/19 08:29AM, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> "Question?" is maybe not the most informative thing to ask. In the
> absence of better information, it is the best we can do, of course.
> 
> However, Git for Windows' auto updater just learned the trick to use
> git-gui--askyesno to ask the user whether to update now or not. And in
> this scripted scenario, we can easily pass a command-line option to
> change the window title.
> 
> So let's support that with the new `--title <title>` option.
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  git-gui--askyesno | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/git-gui--askyesno b/git-gui--askyesno
> index cf9c990d09..45b0260eff 100755
> --- a/git-gui--askyesno
> +++ b/git-gui--askyesno
> @@ -12,10 +12,15 @@ if {$use_ttk} {
>  	set NS ttk
>  }
>  
> +set title "Question?"
>  if {$argc < 1} {
>  	puts stderr "Usage: $argv0 <question>"
>  	exit 1
>  } else {
> +	if {$argc > 2 && [lindex $argv 0] == "--title"} {

While this is probably not the most robust way of handling command line 
arguments, I guess it doesn't really make too much of a difference for 
something this simple.

> +		set title [lindex $argv 1]
> +		set argv [lreplace $argv 0 1]
> +	}
>  	set prompt [join $argv " "]
>  }
>  
> @@ -47,5 +52,5 @@ proc yes {} {
>  	exit 0
>  }
>  
> -wm title . "Question?"
> +wm title . $title
>  tk::PlaceWindow .
> -- 
> gitgitgadget
> 

-- 
Regards,
Pratyush Yadav

```

## Pratyush Yadav, 2019-09-29 18:01

Subject: Re: [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available
Message-ID: <20190929180157.ogwmiaer4pjjduoj@yadavpratyush.com>
URL: https://gitlist.dev/e/20190929180157.ogwmiaer4pjjduoj%40yadavpratyush.com
In-Reply-To: <6025b38d2659caa111d2e5e9a1fa48d47de0e827.1569511793.git.gitgitgadget@gmail.com>

```
Since this is a git-gui dialog/prompt, why not use the git-gui icon? 
This will mean some uniformity between all the platforms (though I'm not 
sure if other platforms even use GIT_ASK_YESNO). It would also probably 
save you the hacks needed to find out the git-for-windows icon.

Well, there is the problem that the git-gui logo is not in any external 
file, and is inside git-gui.sh (as a vector image, but I'm not sure). 
But I'd like to at least start some discussion in this direction.

On 26/09/19 08:30AM, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> For additional GUI goodness.
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  git-gui--askyesno | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/git-gui--askyesno b/git-gui--askyesno
> index 45b0260eff..c0c82e7cbd 100755
> --- a/git-gui--askyesno
> +++ b/git-gui--askyesno
> @@ -52,5 +52,17 @@ proc yes {} {
>  	exit 0
>  }
>  
> +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 .
> -- 
> gitgitgadget

-- 
Regards,
Pratyush Yadav

```

## Johannes Schindelin via GitGitGadget, 2025-08-28 08:58

Subject: [PATCH v2 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows
Message-ID: <pull.358.v2.git.1756371530.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.358.v2.git.1756371530.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.git.gitgitgadget@gmail.com>

```
This is another set of patches from Git for Windows' fork that have been
sitting there since 2010, providing cross-platform GUI helpers to ask the
user a question or allow typing in a password.

This patch series was first submitted as
https://github.com/patthoyts/git-gui/pull/5 which was ignored for almost
three years, then re-submitted as
https://github.com/prati0100/git-gui/pull/3 which was rejected in favor of a
contribution by mail.

The patches are based on Git GUI's master branch at
https://github.com/j6t/git-gui/.

Changes since v1:

 * Rebased to current master branch of Git GUI, resolving merge conflicts.
 * Dropped double empty line.
 * Skip yes/no functions in favor of inline exit 0/exit 1.
 * The --title option is now documented in the git-gui--askyesno script.

Heiko Voigt (1):
  git-gui: provide question helper for retry fallback on Windows

Johannes Schindelin (3):
  git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
  git-gui--askyesno: allow overriding the window title
  git-gui--askyesno (mingw): use Git for Windows' icon, if available

 Makefile          |  2 ++
 git-gui--askyesno | 63 +++++++++++++++++++++++++++++++++++++++++++++++
 git-gui.sh        |  6 +++++
 3 files changed, 71 insertions(+)
 create mode 100755 git-gui--askyesno


base-commit: e3923e3e90da55e12545b5ef5aa34f21e97409d8
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-358%2Fdscho%2Fgit-gui-askpass-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-358/dscho/git-gui-askpass-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/358

Range-diff vs v1:

 1:  58972068a230 ! 1:  08b106ebedb9 git-gui: provide question helper for retry fallback on Windows
     @@ git-gui--askyesno (new)
      +}
      +
      +${NS}::frame .t
     -+${NS}::label .t.m -text $prompt -justify center -width 400px
     -+.t.m configure -wraplength 400px
     ++${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 yes
     -+${NS}::button .b.no  -text No  -command no
     -+
     ++${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
     @@ git-gui--askyesno (new)
      +bind . <Key-Return> {exit 0}
      +bind . <Key-Escape> {exit 1}
      +
     -+proc no {} {
     -+	exit 1
     -+}
     -+
     -+proc yes {} {
     -+	exit 0
     -+}
     -+
      +wm title . "Question?"
      +tk::PlaceWindow .
      
       ## git-gui.sh ##
     -@@ git-gui.sh: set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
     +@@ git-gui.sh: set argv0dir [file dirname [file normalize $::argv0]]
       if {![info exists env(SSH_ASKPASS)]} {
     - 	set env(SSH_ASKPASS) [gitexec git-gui--askpass]
     + 	set env(SSH_ASKPASS) [file join $argv0dir git-gui--askpass]
       }
      +if {![info exists env(GIT_ASK_YESNO)]} {
     -+	set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
     ++	set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
      +}
     + unset argv0dir
       
       ######################################################################
     - ##
 2:  cb9f8c8158c5 ! 2:  e1aef533bfe8 git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
     @@ Commit message
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
       ## git-gui.sh ##
     -@@ git-gui.sh: set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
     +@@ git-gui.sh: set argv0dir [file dirname [file normalize $::argv0]]
       if {![info exists env(SSH_ASKPASS)]} {
     - 	set env(SSH_ASKPASS) [gitexec git-gui--askpass]
     + 	set env(SSH_ASKPASS) [file join $argv0dir git-gui--askpass]
       }
      +if {![info exists env(GIT_ASKPASS)]} {
      +	set env(GIT_ASKPASS) [gitexec git-gui--askpass]
      +}
       if {![info exists env(GIT_ASK_YESNO)]} {
     - 	set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
     + 	set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
       }
 3:  8cfc935cdba3 ! 3:  2e7e2c1524a7 git-gui--askyesno: allow overriding the window title
     @@ Commit message
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
       ## git-gui--askyesno ##
     +@@ git-gui--askyesno: 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]
      @@ git-gui--askyesno: if {$use_ttk} {
       	set NS ttk
       }
     @@ git-gui--askyesno: if {$use_ttk} {
       	set prompt [join $argv " "]
       }
       
     -@@ git-gui--askyesno: proc yes {} {
     - 	exit 0
     - }
     +@@ git-gui--askyesno: pack .b -side bottom -fill x -ipadx 20 -ipady 15
     + bind . <Key-Return> {exit 0}
     + bind . <Key-Escape> {exit 1}
       
      -wm title . "Question?"
      +wm title . $title
 4:  6025b38d2659 ! 4:  4b04832c0b81 git-gui--askyesno (mingw): use Git for Windows' icon, if available
     @@ Metadata
       ## Commit message ##
          git-gui--askyesno (mingw): use Git for Windows' icon, if available
      
     -    For additional GUI goodness.
     +    This provides a unified look-and-feel in Git for Windows.
      
          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
      
       ## git-gui--askyesno ##
     -@@ git-gui--askyesno: proc yes {} {
     - 	exit 0
     - }
     +@@ git-gui--askyesno: pack .b -side bottom -fill x -ipadx 20 -ipady 15
     + bind . <Key-Return> {exit 0}
     + bind . <Key-Escape> {exit 1}
       
      +if {$::tcl_platform(platform) eq {windows}} {
      +	set icopath [file dirname [file normalize $argv0]]

-- 
gitgitgadget

```

## Heiko Voigt via GitGitGadget, 2025-08-28 08:58

Subject: [PATCH v2 1/4] git-gui: provide question helper for retry fallback on Windows
Message-ID: <08b106ebedb90c0e25b0d6802bf5aa81cc9f2da0.1756371530.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/08b106ebedb90c0e25b0d6802bf5aa81cc9f2da0.1756371530.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.v2.git.1756371530.gitgitgadget@gmail.com>

```
From: Heiko Voigt <hvoigt@hvoigt.net>

Make use of the new environment variable GIT_ASK_YESNO to support the
recently implemented fallback in case unlink, rename or rmdir fail for
files in use on Windows. The added dialog will present a yes/no question
to the the user which will currently be used by the windows compat layer
to let the user retry a failed file operation.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile          |  2 ++
 git-gui--askyesno | 42 ++++++++++++++++++++++++++++++++++++++++++
 git-gui.sh        |  3 +++
 3 files changed, 47 insertions(+)
 create mode 100755 git-gui--askyesno

diff --git a/Makefile b/Makefile
index 2cd160b05755..6385db443929 100644
--- a/Makefile
+++ b/Makefile
@@ -185,6 +185,7 @@ install: all
 	$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
 	$(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(QUIET)$(INSTALL_X0)git-gui--askpass $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
+	$(QUIET)$(INSTALL_X0)git-gui--askyesno $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true
 ifdef GITGUI_WINDOWS_WRAPPER
 	$(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
@@ -199,6 +200,7 @@ uninstall:
 	$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
 	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askpass $(REMOVE_F1)
+	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askyesno $(REMOVE_F1)
 	$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
 ifdef GITGUI_WINDOWS_WRAPPER
 	$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)
diff --git a/git-gui--askyesno b/git-gui--askyesno
new file mode 100755
index 000000000000..f7312c70c2ca
--- /dev/null
+++ b/git-gui--askyesno
@@ -0,0 +1,42 @@
+#!/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.
+
+set NS {}
+set use_ttk [package vsatisfies [package provide Tk] 8.5]
+if {$use_ttk} {
+	set NS ttk
+}
+
+if {$argc < 1} {
+	puts stderr "Usage: $argv0 <question>"
+	exit 1
+} else {
+	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 . <Key-Return> {exit 0}
+bind . <Key-Escape> {exit 1}
+
+wm title . "Question?"
+tk::PlaceWindow .
diff --git a/git-gui.sh b/git-gui.sh
index a931d7f7c990..1a4b73a3373a 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1130,6 +1130,9 @@ 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_ASK_YESNO)]} {
+	set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
+}
 unset argv0dir
 
 ######################################################################
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2025-08-28 08:58

Subject: [PATCH v2 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Message-ID: <e1aef533bfe89bfb87b1a83bf7c7375e6238b06f.1756371530.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/e1aef533bfe89bfb87b1a83bf7c7375e6238b06f.1756371530.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.v2.git.1756371530.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/git-gui.sh b/git-gui.sh
index 1a4b73a3373a..63a6b7408639 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1130,6 +1130,9 @@ 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) [gitexec git-gui--askpass]
+}
 if {![info exists env(GIT_ASK_YESNO)]} {
 	set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
 }
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2025-08-28 08:58

Subject: [PATCH v2 3/4] git-gui--askyesno: allow overriding the window title
Message-ID: <2e7e2c1524a73b3c1aaf28baf5689be4093f62ed.1756371530.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/2e7e2c1524a73b3c1aaf28baf5689be4093f62ed.1756371530.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.v2.git.1756371530.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

"Question?" is maybe not the most informative thing to ask. In the
absence of better information, it is the best we can do, of course.

However, Git for Windows' auto updater just learned the trick to use
git-gui--askyesno to ask the user whether to update now or not. And in
this scripted scenario, we can easily pass a command-line option to
change the window title.

So let's support that with the new `--title <title>` option.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui--askyesno | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/git-gui--askyesno b/git-gui--askyesno
index f7312c70c2ca..d0c801c42c7c 100755
--- a/git-gui--askyesno
+++ b/git-gui--askyesno
@@ -5,6 +5,10 @@ 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]
@@ -12,10 +16,15 @@ if {$use_ttk} {
 	set NS ttk
 }
 
+set title "Question?"
 if {$argc < 1} {
 	puts stderr "Usage: $argv0 <question>"
 	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 " "]
 }
 
@@ -38,5 +47,5 @@ pack .b -side bottom -fill x -ipadx 20 -ipady 15
 bind . <Key-Return> {exit 0}
 bind . <Key-Escape> {exit 1}
 
-wm title . "Question?"
+wm title . $title
 tk::PlaceWindow .
-- 
gitgitgadget


```

## Johannes Schindelin via GitGitGadget, 2025-08-28 08:58

Subject: [PATCH v2 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available
Message-ID: <4b04832c0b8119b784806f54a2354d910965a523.1756371530.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/4b04832c0b8119b784806f54a2354d910965a523.1756371530.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.358.v2.git.1756371530.gitgitgadget@gmail.com>

```
From: Johannes Schindelin <johannes.schindelin@gmx.de>

This provides a unified look-and-feel in Git for Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui--askyesno | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/git-gui--askyesno b/git-gui--askyesno
index d0c801c42c7c..142d1bc3de22 100755
--- a/git-gui--askyesno
+++ b/git-gui--askyesno
@@ -47,5 +47,17 @@ pack .b -side bottom -fill x -ipadx 20 -ipady 15
 bind . <Key-Return> {exit 0}
 bind . <Key-Escape> {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 .
-- 
gitgitgadget

```

## Mark Levedahl, 2025-08-28 13:33

Subject: [PATCH] git-gui: use tk_messageBox for ask yes/no
Message-ID: <20250828133301.74328-1-mlevedahl@gmail.com>
URL: https://gitlist.dev/e/20250828133301.74328-1-mlevedahl%40gmail.com
In-Reply-To: <4b04832c0b8119b784806f54a2354d910965a523.1756371530.git.gitgitgadget@gmail.com>

```
git-gui includes git-gui--yesno that relies upon Tk 8.5 constructs, and
this dialog box is not supported with Tk 9.0.  Tk provides tk_messagebox
for this same purpose, fully supported in Tk 8.5+, so use tk_messagebox
instead.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 git-gui--askyesno | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/git-gui--askyesno b/git-gui--askyesno
index 142d1bc..cd986f2 100755
--- a/git-gui--askyesno
+++ b/git-gui--askyesno
@@ -10,12 +10,6 @@ exec wish "$0" -- "$@"
 # 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 <question>"
@@ -28,25 +22,7 @@ if {$argc < 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 . <Key-Return> {exit 0}
-bind . <Key-Escape> {exit 1}
-
+set dlgicon {question}
 if {$::tcl_platform(platform) eq {windows}} {
 	set icopath [file dirname [file normalize $argv0]]
 	if {[file tail $icopath] eq {git-core}} {
@@ -55,9 +31,12 @@ if {$::tcl_platform(platform) eq {windows}} {
 	set icopath [file dirname $icopath]
 	set icopath [file join $icopath share git git-for-windows.ico]
 	if {[file exists $icopath]} {
-		wm iconbitmap . -default $icopath
+		set dlgicon $icopath
 	}
 }
 
-wm title . $title
-tk::PlaceWindow .
+wm withdraw .
+
+option add *Dialog.msg.font {Sans 10}
+set ans [tk_messageBox -icon $dlgicon -message $prompt -title $title -type yesno]
+exit [expr $ans eq {no}]
-- 
2.51.0.99.15


```

## Johannes Schindelin, 2025-08-28 13:49

Subject: Re: [PATCH] git-gui: use tk_messageBox for ask yes/no
Message-ID: <33e2ad25-cafa-66a4-7bde-056ebbf6a5d0@gmx.de>
URL: https://gitlist.dev/e/33e2ad25-cafa-66a4-7bde-056ebbf6a5d0%40gmx.de
In-Reply-To: <20250828133301.74328-1-mlevedahl@gmail.com>

```
Hi Mark,

On Thu, 28 Aug 2025, Mark Levedahl wrote:

> git-gui includes git-gui--yesno that relies upon Tk 8.5 constructs, and
> this dialog box is not supported with Tk 9.0.  Tk provides tk_messagebox
> for this same purpose, fully supported in Tk 8.5+, so use tk_messagebox
> instead.

Thank you very much!

Let's keep your patch separate, to give you full credit, and to keep
Heiko's patch as close to the original that has survived in Git for
Windows for so long.

Ciao,
Johannes

> 
> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
> ---
>  git-gui--askyesno | 35 +++++++----------------------------
>  1 file changed, 7 insertions(+), 28 deletions(-)
> 
> diff --git a/git-gui--askyesno b/git-gui--askyesno
> index 142d1bc..cd986f2 100755
> --- a/git-gui--askyesno
> +++ b/git-gui--askyesno
> @@ -10,12 +10,6 @@ exec wish "$0" -- "$@"
>  # 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 <question>"
> @@ -28,25 +22,7 @@ if {$argc < 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 . <Key-Return> {exit 0}
> -bind . <Key-Escape> {exit 1}
> -
> +set dlgicon {question}
>  if {$::tcl_platform(platform) eq {windows}} {
>  	set icopath [file dirname [file normalize $argv0]]
>  	if {[file tail $icopath] eq {git-core}} {
> @@ -55,9 +31,12 @@ if {$::tcl_platform(platform) eq {windows}} {
>  	set icopath [file dirname $icopath]
>  	set icopath [file join $icopath share git git-for-windows.ico]
>  	if {[file exists $icopath]} {
> -		wm iconbitmap . -default $icopath
> +		set dlgicon $icopath
>  	}
>  }
>  
> -wm title . $title
> -tk::PlaceWindow .
> +wm withdraw .
> +
> +option add *Dialog.msg.font {Sans 10}
> +set ans [tk_messageBox -icon $dlgicon -message $prompt -title $title -type yesno]
> +exit [expr $ans eq {no}]
> -- 
> 2.51.0.99.15
> 
> 
> 

```

## Johannes Sixt, 2025-08-28 17:44

Subject: Re: [PATCH v2 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Message-ID: <816cd946-4f25-4ce8-aa06-6babf9e90751@kdbg.org>
URL: https://gitlist.dev/e/816cd946-4f25-4ce8-aa06-6babf9e90751%40kdbg.org
In-Reply-To: <e1aef533bfe89bfb87b1a83bf7c7375e6238b06f.1756371530.git.gitgitgadget@gmail.com>

```
Am 28.08.25 um 10:58 schrieb Johannes Schindelin via GitGitGadget:
> @@ -1130,6 +1130,9 @@ 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) [gitexec git-gui--askpass]

Is this [gitexec ...] deliberate, or can this be [file join ...] like in
the surrounding cases? If it is deliberate, we need an updated commit
message and/or a comment, otherwise, I can amend locally while queuing.

> +}
>  if {![info exists env(GIT_ASK_YESNO)]} {
>  	set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
>  }


```

## Johannes Sixt, 2025-08-28 21:18

Subject: Re: [PATCH] git-gui: use tk_messageBox for ask yes/no
Message-ID: <d89cf43f-78c7-46df-878e-b12044c4aa5c@kdbg.org>
URL: https://gitlist.dev/e/d89cf43f-78c7-46df-878e-b12044c4aa5c%40kdbg.org
In-Reply-To: <20250828133301.74328-1-mlevedahl@gmail.com>

```
Am 28.08.25 um 15:33 schrieb Mark Levedahl:
> git-gui includes git-gui--yesno that relies upon Tk 8.5 constructs, and

/--yesno/--askyesno/? BTW, I wonder which constructs you mean.

> this dialog box is not supported with Tk 9.0.  Tk provides tk_messagebox
> for this same purpose, fully supported in Tk 8.5+, so use tk_messagebox
> instead.

Which "this dialog box" do you mean here? The old code looks like a
usual Tk main window to me.

> 
> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
> ---
>  git-gui--askyesno | 35 +++++++----------------------------
>  1 file changed, 7 insertions(+), 28 deletions(-)
> 
> diff --git a/git-gui--askyesno b/git-gui--askyesno
> index 142d1bc..cd986f2 100755
> --- a/git-gui--askyesno
> +++ b/git-gui--askyesno
> @@ -10,12 +10,6 @@ exec wish "$0" -- "$@"
>  # 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 <question>"
> @@ -28,25 +22,7 @@ if {$argc < 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 . <Key-Return> {exit 0}
> -bind . <Key-Escape> {exit 1}
> -
> +set dlgicon {question}
>  if {$::tcl_platform(platform) eq {windows}} {
>  	set icopath [file dirname [file normalize $argv0]]
>  	if {[file tail $icopath] eq {git-core}} {
> @@ -55,9 +31,12 @@ if {$::tcl_platform(platform) eq {windows}} {
>  	set icopath [file dirname $icopath]
>  	set icopath [file join $icopath share git git-for-windows.ico]
>  	if {[file exists $icopath]} {
> -		wm iconbitmap . -default $icopath
> +		set dlgicon $icopath
>  	}
>  }

I think there is a misunderstanding what the purpose of this icon is. It
is the icon shown on the window frame/decoration, not the icon next to
the text.

>  
> -wm title . $title
> -tk::PlaceWindow .
> +wm withdraw .
> +
> +option add *Dialog.msg.font {Sans 10}

Is this to replicate the old appearance? I don't think it is necessary.
Let's assume tk_messageBox does a sensible thing.

> +set ans [tk_messageBox -icon $dlgicon -message $prompt -title $title -type yesno]

This option -icon can only be one of the words error, info, question or
warning. It has nothing to do with the icon above.

> +exit [expr $ans eq {no}]

-- Hannes


```

## Johannes Schindelin, 2025-11-17 14:03

Subject: Re: [PATCH v2 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Message-ID: <1295d263-e60d-0acb-91ef-9de888398840@gmx.de>
URL: https://gitlist.dev/e/1295d263-e60d-0acb-91ef-9de888398840%40gmx.de
In-Reply-To: <816cd946-4f25-4ce8-aa06-6babf9e90751@kdbg.org>

```
Hi Hannes,

On Thu, 28 Aug 2025, Johannes Sixt wrote:

> Am 28.08.25 um 10:58 schrieb Johannes Schindelin via GitGitGadget:
> > @@ -1130,6 +1130,9 @@ 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) [gitexec git-gui--askpass]
> 
> Is this [gitexec ...] deliberate, or can this be [file join ...] like in
> the surrounding cases? If it is deliberate, we need an updated commit
> message and/or a comment, otherwise, I can amend locally while queuing.

Sorry for the late reply. As you suspected (seeing as you changed it when
integrating sthe patch into your tree), it was just an artifact of
history.

This patch entered Git for Windows back in the msysGit days, in
https://github.com/msysgit/git/commit/1644f8ea0159 (2010-07-23), according
to my records that corresponds to the v1.7.2.3.msysgit.0 timeframe, when
this block was surrounded by similar, `[gitexec]`-using code blocks.

The patch remained virtually unchanged until
https://github.com/git-for-windows/git/commit/076c4bc42171 (2025-06-16),
which still made it into v2.50.0.

Starting with https://github.com/git-for-windows/git/commit/ab11df9a3899
(2025-08-05), this block's context changed, and I must have changed the
block itself in reaction to it in Git for Windows (but I failed to miss it
before sending the patch you reviewed). The patch made it into v2.51.0-rc0
in that new shape, using `[file join ...]` instead of `[gitexec]`.

Luckily, you made the very same adjustment before committing it as
https://github.com/git/git/commit/aeaabebc1a10 (2025-08-28), so all is
good.

Ciao,
Johannes

> 
> > +}
> >  if {![info exists env(GIT_ASK_YESNO)]} {
> >  	set env(GIT_ASK_YESNO) [file join $argv0dir git-gui--askyesno]
> >  }
> 
> 

```
