Skip to content

Commit fe0126f

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'gitk-and-git-gui-patches'
These are Git for Windows' Git GUI and gitk patches. We will have to decide at some point what to do about them, but that's a little lower priority (as Git GUI seems to be unmaintained for the time being, and the gitk maintainer keeps a very low profile on the Git mailing list, too). Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 0c0803f + 6857ebf commit fe0126f

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

git-gui/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ install: all
224224
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
225225
$(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
226226
$(QUIET)$(INSTALL_X0)git-gui--askpass $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
227+
$(QUIET)$(INSTALL_X0)git-gui--askyesno $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
227228
$(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
228229
ifdef GITGUI_WINDOWS_WRAPPER
229230
$(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
@@ -242,6 +243,7 @@ uninstall:
242243
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
243244
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
244245
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askpass $(REMOVE_F1)
246+
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askyesno $(REMOVE_F1)
245247
$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
246248
ifdef GITGUI_WINDOWS_WRAPPER
247249
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)

git-gui/git-gui--askyesno

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/sh
2+
# Tcl ignores the next line -*- tcl -*- \
3+
exec wish "$0" -- "$@"
4+
5+
# This is an implementation of a simple yes no dialog
6+
# which is injected into the git commandline by git gui
7+
# in case a yesno question needs to be answered.
8+
9+
set NS {}
10+
set use_ttk [package vsatisfies [package provide Tk] 8.5]
11+
if {$use_ttk} {
12+
set NS ttk
13+
}
14+
15+
set title "Question?"
16+
if {$argc < 1} {
17+
puts stderr "Usage: $argv0 <question>"
18+
exit 1
19+
} else {
20+
if {$argc > 2 && [lindex $argv 0] == "--title"} {
21+
set title [lindex $argv 1]
22+
set argv [lreplace $argv 0 1]
23+
}
24+
set prompt [join $argv " "]
25+
}
26+
27+
${NS}::frame .t
28+
${NS}::label .t.m -text $prompt -justify center -width 400px
29+
.t.m configure -wraplength 400px
30+
pack .t.m -side top -fill x -padx 20 -pady 20 -expand 1
31+
pack .t -side top -fill x -ipadx 20 -ipady 20 -expand 1
32+
33+
${NS}::frame .b
34+
${NS}::frame .b.left -width 200
35+
${NS}::button .b.yes -text Yes -command yes
36+
${NS}::button .b.no -text No -command no
37+
38+
39+
pack .b.left -side left -expand 1 -fill x
40+
pack .b.yes -side left -expand 1
41+
pack .b.no -side right -expand 1 -ipadx 5
42+
pack .b -side bottom -fill x -ipadx 20 -ipady 15
43+
44+
bind . <Key-Return> {exit 0}
45+
bind . <Key-Escape> {exit 1}
46+
47+
proc no {} {
48+
exit 1
49+
}
50+
51+
proc yes {} {
52+
exit 0
53+
}
54+
55+
if {$::tcl_platform(platform) eq {windows}} {
56+
set icopath [file dirname [file normalize $argv0]]
57+
if {[file tail $icopath] eq {git-core}} {
58+
set icopath [file dirname $icopath]
59+
}
60+
set icopath [file dirname $icopath]
61+
set icopath [file join $icopath share git git-for-windows.ico]
62+
if {[file exists $icopath]} {
63+
wm iconbitmap . -default $icopath
64+
}
65+
}
66+
67+
wm title . $title
68+
tk::PlaceWindow .

git-gui/git-gui.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,12 @@ set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12561256
if {![info exists env(SSH_ASKPASS)]} {
12571257
set env(SSH_ASKPASS) [gitexec git-gui--askpass]
12581258
}
1259+
if {![info exists env(GIT_ASKPASS)]} {
1260+
set env(GIT_ASKPASS) [gitexec git-gui--askpass]
1261+
}
1262+
if {![info exists env(GIT_ASK_YESNO)]} {
1263+
set env(GIT_ASK_YESNO) [gitexec git-gui--askyesno]
1264+
}
12591265

12601266
######################################################################
12611267
##

0 commit comments

Comments
 (0)