Skip to content

Commit f6576f4

Browse files
committed
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: (27 commits) git-gui: Update German translation. git-gui: Do not munge conflict marker lines in a normal diff git-gui: Add a simple implementation of SSH_ASKPASS. git-gui: Add a dialog that shows the OpenSSH public key. git-gui: Mark-up strings in show_{other,unmerged}_diff() for localization git-gui: Show a round number of bytes of large untracked text files git-gui: Fix the blame viewer destroy handler. git-gui: Add a search command to the blame viewer. git-gui: Fix the blame window shape. git-gui: Fix switch statement in lib/merge.tcl git-gui: Fix fetching from remotes when adding them git-gui: Fix removing non-pushable remotes git-gui: Make input boxes in init/clone/open dialogs consistent git-gui: Avoid using the term URL when specifying repositories git-gui: gui.autoexplore makes explorer to pop up automatically after picking git-gui: Add Explore Working Copy to the Repository menu git-gui: Use git web--browser for web browsing git-gui: mkdir -p when initializing new remote repository git-gui: Add support for removing remotes git-gui: Add support for adding remotes ...
2 parents 933bb3a + 9d83c6a commit f6576f4

17 files changed

+1080
-190
lines changed

git-gui/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
285285
install: all
286286
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
287287
$(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
288+
$(QUIET)$(INSTALL_X0)git-gui--askpass $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
288289
$(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
289290
ifdef GITGUI_WINDOWS_WRAPPER
290291
$(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
@@ -302,6 +303,7 @@ endif
302303
uninstall:
303304
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
304305
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
306+
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askpass $(REMOVE_F1)
305307
$(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
306308
ifdef GITGUI_WINDOWS_WRAPPER
307309
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)

git-gui/git-gui--askpass

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
# Tcl ignores the next line -*- tcl -*- \
3+
exec wish "$0" -- "$@"
4+
5+
# This is a trivial implementation of an SSH_ASKPASS handler.
6+
# Git-gui uses this script if none are already configured.
7+
8+
set answer {}
9+
set yesno 0
10+
set rc 255
11+
12+
if {$argc < 1} {
13+
set prompt "Enter your OpenSSH passphrase:"
14+
} else {
15+
set prompt [join $argv " "]
16+
if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {
17+
set yesno 1
18+
}
19+
}
20+
21+
message .m -text $prompt -justify center -aspect 4000
22+
pack .m -side top -fill x -padx 20 -pady 20 -expand 1
23+
24+
entry .e -textvariable answer -width 50
25+
pack .e -side top -fill x -padx 10 -pady 10
26+
27+
if {!$yesno} {
28+
.e configure -show "*"
29+
}
30+
31+
frame .b
32+
button .b.ok -text OK -command finish
33+
button .b.cancel -text Cancel -command {destroy .}
34+
35+
pack .b.ok -side left -expand 1
36+
pack .b.cancel -side right -expand 1
37+
pack .b -side bottom -fill x -padx 10 -pady 10
38+
39+
bind . <Visibility> {focus -force .e}
40+
bind . <Key-Return> finish
41+
bind . <Key-Escape> {destroy .}
42+
bind . <Destroy> {exit $rc}
43+
44+
proc finish {} {
45+
if {$::yesno} {
46+
if {$::answer ne "yes" && $::answer ne "no"} {
47+
tk_messageBox -icon error -title "Error" -type ok \
48+
-message "Only 'yes' or 'no' input allowed."
49+
return
50+
}
51+
}
52+
53+
set ::rc 0
54+
puts $::answer
55+
destroy .
56+
}
57+
58+
wm title . "OpenSSH"
59+
tk::PlaceWindow .

git-gui/git-gui.sh

Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,12 @@ bind . <Visibility> {
591591
592592
if {[is_Windows]} {
593593
wm iconbitmap . -default $oguilib/git-gui.ico
594+
set ::tk::AlwaysShowSelection 1
595+
596+
# Spoof an X11 display for SSH
597+
if {![info exists env(DISPLAY)]} {
598+
set env(DISPLAY) :9999
599+
}
594600
}
595601
596602
######################################################################
@@ -995,6 +1001,7 @@ citool {
9951001
##
9961002
## repository setup
9971003
1004+
set picked 0
9981005
if {[catch {
9991006
set _gitdir $env(GIT_DIR)
10001007
set _prefix {}
@@ -1006,6 +1013,7 @@ if {[catch {
10061013
load_config 1
10071014
apply_config
10081015
choose_repository::pick
1016+
set picked 1
10091017
}
10101018
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
10111019
catch {set _gitdir [exec cygpath --windows $_gitdir]}
@@ -1065,6 +1073,15 @@ set selected_commit_type new
10651073
set nullid "0000000000000000000000000000000000000000"
10661074
set nullid2 "0000000000000000000000000000000000000001"
10671075
1076+
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
1077+
1078+
######################################################################
1079+
1080+
# Suggest our implementation of askpass, if none is set
1081+
if {![info exists env(SSH_ASKPASS)]} {
1082+
set env(SSH_ASKPASS) [gitexec git-gui--askpass]
1083+
}
1084+
10681085
######################################################################
10691086
##
10701087
## task management
@@ -1869,6 +1886,19 @@ proc do_gitk {revs} {
18691886
}
18701887
}
18711888
1889+
proc do_explore {} {
1890+
set explorer {}
1891+
if {[is_Cygwin] || [is_Windows]} {
1892+
set explorer "explorer.exe"
1893+
} elseif {[is_MacOSX]} {
1894+
set explorer "open"
1895+
} else {
1896+
# freedesktop.org-conforming system is our best shot
1897+
set explorer "xdg-open"
1898+
}
1899+
eval exec $explorer [file dirname [gitdir]] &
1900+
}
1901+
18721902
set is_quitting 0
18731903
set ret_code 1
18741904
@@ -2090,7 +2120,9 @@ proc toggle_or_diff {w x y} {
20902120
if {$col == 0 && $y > 1} {
20912121
# Conflicts need special handling
20922122
if {[string first {U} $state] >= 0} {
2093-
merge_stage_workdir $path $w $lno
2123+
# $w must always be $ui_workdir, but...
2124+
if {$w ne $ui_workdir} { set lno {} }
2125+
merge_stage_workdir $path $lno
20942126
return
20952127
}
20962128
@@ -2218,6 +2250,11 @@ if {[is_enabled transport]} {
22182250
#
22192251
menu .mbar.repository
22202252
2253+
.mbar.repository add command \
2254+
-label [mc "Explore Working Copy"] \
2255+
-command {do_explore}
2256+
.mbar.repository add separator
2257+
22212258
.mbar.repository add command \
22222259
-label [mc "Browse Current Branch's Files"] \
22232260
-command {browser::new $current_branch}
@@ -2413,7 +2450,7 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
24132450
24142451
.mbar.commit add separator
24152452
2416-
if {![is_enabled nocommit]} {
2453+
if {![is_enabled nocommitmsg]} {
24172454
.mbar.commit add command -label [mc "Sign Off"] \
24182455
-command do_signoff \
24192456
-accelerator $M1T-S
@@ -2446,12 +2483,16 @@ if {[is_enabled branch]} {
24462483
if {[is_enabled transport]} {
24472484
menu .mbar.remote
24482485
2486+
.mbar.remote add command \
2487+
-label [mc "Add..."] \
2488+
-command remote_add::dialog \
2489+
-accelerator $M1T-A
24492490
.mbar.remote add command \
24502491
-label [mc "Push..."] \
24512492
-command do_push_anywhere \
24522493
-accelerator $M1T-P
24532494
.mbar.remote add command \
2454-
-label [mc "Delete..."] \
2495+
-label [mc "Delete Branch..."] \
24552496
-command remote_branch_delete::dialog
24562497
}
24572498
@@ -2487,43 +2528,31 @@ if {![is_MacOSX]} {
24872528
-command do_about
24882529
}
24892530
2490-
set browser {}
2491-
catch {set browser $repo_config(instaweb.browser)}
2531+
24922532
set doc_path [file dirname [gitexec]]
24932533
set doc_path [file join $doc_path Documentation index.html]
24942534
24952535
if {[is_Cygwin]} {
24962536
set doc_path [exec cygpath --mixed $doc_path]
24972537
}
24982538
2499-
if {$browser eq {}} {
2500-
if {[is_MacOSX]} {
2501-
set browser open
2502-
} elseif {[is_Cygwin]} {
2503-
set program_files [file dirname [exec cygpath --windir]]
2504-
set program_files [file join $program_files {Program Files}]
2505-
set firefox [file join $program_files {Mozilla Firefox} firefox.exe]
2506-
set ie [file join $program_files {Internet Explorer} IEXPLORE.EXE]
2507-
if {[file exists $firefox]} {
2508-
set browser $firefox
2509-
} elseif {[file exists $ie]} {
2510-
set browser $ie
2511-
}
2512-
unset program_files firefox ie
2513-
}
2514-
}
2515-
25162539
if {[file isfile $doc_path]} {
25172540
set doc_url "file:$doc_path"
25182541
} else {
25192542
set doc_url {http://www.kernel.org/pub/software/scm/git/docs/}
25202543
}
25212544
2522-
if {$browser ne {}} {
2523-
.mbar.help add command -label [mc "Online Documentation"] \
2524-
-command [list exec $browser $doc_url &]
2545+
proc start_browser {url} {
2546+
git "web--browse" $url
25252547
}
2526-
unset browser doc_path doc_url
2548+
2549+
.mbar.help add command -label [mc "Online Documentation"] \
2550+
-command [list start_browser $doc_url]
2551+
2552+
.mbar.help add command -label [mc "Show SSH Key"] \
2553+
-command do_ssh_key
2554+
2555+
unset doc_path doc_url
25272556
25282557
# -- Standard bindings
25292558
#
@@ -2743,7 +2772,7 @@ pack .vpane.lower.commarea.buttons.incall -side top -fill x
27432772
lappend disable_on_lock \
27442773
{.vpane.lower.commarea.buttons.incall conf -state}
27452774
2746-
if {![is_enabled nocommit]} {
2775+
if {![is_enabled nocommitmsg]} {
27472776
button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
27482777
-command do_signoff
27492778
pack .vpane.lower.commarea.buttons.signoff -side top -fill x
@@ -3261,8 +3290,7 @@ if {[is_enabled transport]} {
32613290
load_all_remotes
32623291
32633292
set n [.mbar.remote index end]
3264-
populate_push_menu
3265-
populate_fetch_menu
3293+
populate_remotes_menu
32663294
set n [expr {[.mbar.remote index end] - $n}]
32673295
if {$n > 0} {
32683296
if {[.mbar.remote type 0] eq "tearoff"} { incr n }
@@ -3369,3 +3397,6 @@ if {[is_enabled multicommit]} {
33693397
if {[is_enabled retcode]} {
33703398
bind . <Destroy> {+terminate_me %W}
33713399
}
3400+
if {$picked && [is_config_true gui.autoexplore]} {
3401+
do_explore
3402+
}

0 commit comments

Comments
 (0)