From: "Heiko Voigt via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Sixt <j6t@kdbg.org>,
Johannes Schindelin <johannes.schindelin@gmx.de>,
Pratyush Yadav <me@yadavpratyush.com>,
Heiko Voigt <hvoigt@hvoigt.net>
Subject: [PATCH v2 1/4] git-gui: provide question helper for retry fallback on Windows
Date: Thu, 28 Aug 2025 08:58:47 +0000 [thread overview]
Message-ID: <08b106ebedb90c0e25b0d6802bf5aa81cc9f2da0.1756371530.git.gitgitgadget@gmail.com> (raw)
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
next prev parent reply other threads:[~2025-08-28 8:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 15:29 [PATCH 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows Johannes Schindelin via GitGitGadget
2019-09-26 15:29 ` [PATCH 1/4] git-gui: provide question helper for retry fallback on Windows Heiko Voigt via GitGitGadget
2019-09-29 17:11 ` Pratyush Yadav
2019-09-26 15:29 ` [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet Johannes Schindelin via GitGitGadget
2019-09-29 17:15 ` Pratyush Yadav
2019-09-26 15:29 ` [PATCH 3/4] git-gui--askyesno: allow overriding the window title Johannes Schindelin via GitGitGadget
2019-09-29 17:31 ` Pratyush Yadav
2019-09-26 15:30 ` [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available Johannes Schindelin via GitGitGadget
2019-09-29 18:01 ` Pratyush Yadav
2025-08-28 8:58 ` [PATCH v2 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows Johannes Schindelin via GitGitGadget
2025-08-28 8:58 ` Heiko Voigt via GitGitGadget [this message]
2025-08-28 8:58 ` [PATCH v2 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet Johannes Schindelin via GitGitGadget
2025-08-28 17:44 ` Johannes Sixt
2025-08-28 8:58 ` [PATCH v2 3/4] git-gui--askyesno: allow overriding the window title Johannes Schindelin via GitGitGadget
2025-08-28 8:58 ` [PATCH v2 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available Johannes Schindelin via GitGitGadget
2025-08-28 13:33 ` [PATCH] git-gui: use tk_messageBox for ask yes/no Mark Levedahl
2025-08-28 13:49 ` Johannes Schindelin
2025-08-28 21:18 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=08b106ebedb90c0e25b0d6802bf5aa81cc9f2da0.1756371530.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
--cc=j6t@kdbg.org \
--cc=johannes.schindelin@gmx.de \
--cc=me@yadavpratyush.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).