git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows
@ 2019-09-26 15:29 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
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-09-26 15:29 UTC (permalink / raw)
  To: git; +Cc: Pratyush Yadav, Junio C Hamano

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] git-gui: provide question helper for retry fallback on Windows
  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 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Heiko Voigt via GitGitGadget @ 2019-09-26 15:29 UTC (permalink / raw)
  To: git; +Cc: Pratyush Yadav, Junio C Hamano, Heiko Voigt

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
  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-26 15:29 ` 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-26 15:30 ` [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available Johannes Schindelin via GitGitGadget
  3 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-09-26 15:29 UTC (permalink / raw)
  To: git; +Cc: Pratyush Yadav, Junio C Hamano, Johannes Schindelin

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] git-gui--askyesno: allow overriding the window title
  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-26 15:29 ` [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet Johannes Schindelin via GitGitGadget
@ 2019-09-26 15:29 ` 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
  3 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-09-26 15:29 UTC (permalink / raw)
  To: git; +Cc: Pratyush Yadav, Junio C Hamano, Johannes Schindelin

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available
  2019-09-26 15:29 [PATCH 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows Johannes Schindelin via GitGitGadget
                   ` (2 preceding siblings ...)
  2019-09-26 15:29 ` [PATCH 3/4] git-gui--askyesno: allow overriding the window title Johannes Schindelin via GitGitGadget
@ 2019-09-26 15:30 ` Johannes Schindelin via GitGitGadget
  2019-09-29 18:01   ` Pratyush Yadav
  3 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-09-26 15:30 UTC (permalink / raw)
  To: git; +Cc: Pratyush Yadav, Junio C Hamano, Johannes Schindelin

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] git-gui: provide question helper for retry fallback on Windows
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Pratyush Yadav @ 2019-09-29 17:11 UTC (permalink / raw)
  To: Heiko Voigt via GitGitGadget; +Cc: git, Junio C Hamano, Heiko Voigt

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Pratyush Yadav @ 2019-09-29 17:15 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget
  Cc: git, Junio C Hamano, Johannes Schindelin

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] git-gui--askyesno: allow overriding the window title
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Pratyush Yadav @ 2019-09-29 17:31 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget
  Cc: git, Junio C Hamano, Johannes Schindelin

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Pratyush Yadav @ 2019-09-29 18:01 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget
  Cc: git, Junio C Hamano, Johannes Schindelin

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-29 18:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).