summaryrefslogtreecommitdiff
path: root/git-gui/git-gui.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-11-01 22:31:46 -0700
committerJunio C Hamano <gitster@pobox.com>2008-11-01 22:31:46 -0700
commitf6576f4c0c6fa3b2d979faf28936c09480dedaab (patch)
tree26bb4d7d46d6e67a050eaa467e88e1a251ee309a /git-gui/git-gui.sh
parent933bb3ae5e6c83288ec7c80c2282984f4927cb48 (diff)
parent9d83c6aa44d2ff68111865b6f72e7321e54a8972 (diff)
downloadgit-f6576f4c0c6fa3b2d979faf28936c09480dedaab.tar.gz
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 ...
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-xgit-gui/git-gui.sh89
1 files changed, 60 insertions, 29 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 4085e8fea5..12b496bec9 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -591,6 +591,12 @@ bind . <Visibility> {
if {[is_Windows]} {
wm iconbitmap . -default $oguilib/git-gui.ico
+ set ::tk::AlwaysShowSelection 1
+
+ # Spoof an X11 display for SSH
+ if {![info exists env(DISPLAY)]} {
+ set env(DISPLAY) :9999
+ }
}
######################################################################
@@ -995,6 +1001,7 @@ citool {
##
## repository setup
+set picked 0
if {[catch {
set _gitdir $env(GIT_DIR)
set _prefix {}
@@ -1006,6 +1013,7 @@ if {[catch {
load_config 1
apply_config
choose_repository::pick
+ set picked 1
}
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
catch {set _gitdir [exec cygpath --windows $_gitdir]}
@@ -1065,6 +1073,15 @@ set selected_commit_type new
set nullid "0000000000000000000000000000000000000000"
set nullid2 "0000000000000000000000000000000000000001"
+set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
+
+######################################################################
+
+# Suggest our implementation of askpass, if none is set
+if {![info exists env(SSH_ASKPASS)]} {
+ set env(SSH_ASKPASS) [gitexec git-gui--askpass]
+}
+
######################################################################
##
## task management
@@ -1869,6 +1886,19 @@ proc do_gitk {revs} {
}
}
+proc do_explore {} {
+ set explorer {}
+ if {[is_Cygwin] || [is_Windows]} {
+ set explorer "explorer.exe"
+ } elseif {[is_MacOSX]} {
+ set explorer "open"
+ } else {
+ # freedesktop.org-conforming system is our best shot
+ set explorer "xdg-open"
+ }
+ eval exec $explorer [file dirname [gitdir]] &
+}
+
set is_quitting 0
set ret_code 1
@@ -2090,7 +2120,9 @@ proc toggle_or_diff {w x y} {
if {$col == 0 && $y > 1} {
# Conflicts need special handling
if {[string first {U} $state] >= 0} {
- merge_stage_workdir $path $w $lno
+ # $w must always be $ui_workdir, but...
+ if {$w ne $ui_workdir} { set lno {} }
+ merge_stage_workdir $path $lno
return
}
@@ -2219,6 +2251,11 @@ if {[is_enabled transport]} {
menu .mbar.repository
.mbar.repository add command \
+ -label [mc "Explore Working Copy"] \
+ -command {do_explore}
+.mbar.repository add separator
+
+.mbar.repository add command \
-label [mc "Browse Current Branch's Files"] \
-command {browser::new $current_branch}
set ui_browse_current [.mbar.repository index last]
@@ -2413,7 +2450,7 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
.mbar.commit add separator
- if {![is_enabled nocommit]} {
+ if {![is_enabled nocommitmsg]} {
.mbar.commit add command -label [mc "Sign Off"] \
-command do_signoff \
-accelerator $M1T-S
@@ -2447,11 +2484,15 @@ if {[is_enabled transport]} {
menu .mbar.remote
.mbar.remote add command \
+ -label [mc "Add..."] \
+ -command remote_add::dialog \
+ -accelerator $M1T-A
+ .mbar.remote add command \
-label [mc "Push..."] \
-command do_push_anywhere \
-accelerator $M1T-P
.mbar.remote add command \
- -label [mc "Delete..."] \
+ -label [mc "Delete Branch..."] \
-command remote_branch_delete::dialog
}
@@ -2487,8 +2528,7 @@ if {![is_MacOSX]} {
-command do_about
}
-set browser {}
-catch {set browser $repo_config(instaweb.browser)}
+
set doc_path [file dirname [gitexec]]
set doc_path [file join $doc_path Documentation index.html]
@@ -2496,34 +2536,23 @@ if {[is_Cygwin]} {
set doc_path [exec cygpath --mixed $doc_path]
}
-if {$browser eq {}} {
- if {[is_MacOSX]} {
- set browser open
- } elseif {[is_Cygwin]} {
- set program_files [file dirname [exec cygpath --windir]]
- set program_files [file join $program_files {Program Files}]
- set firefox [file join $program_files {Mozilla Firefox} firefox.exe]
- set ie [file join $program_files {Internet Explorer} IEXPLORE.EXE]
- if {[file exists $firefox]} {
- set browser $firefox
- } elseif {[file exists $ie]} {
- set browser $ie
- }
- unset program_files firefox ie
- }
-}
-
if {[file isfile $doc_path]} {
set doc_url "file:$doc_path"
} else {
set doc_url {http://www.kernel.org/pub/software/scm/git/docs/}
}
-if {$browser ne {}} {
- .mbar.help add command -label [mc "Online Documentation"] \
- -command [list exec $browser $doc_url &]
+proc start_browser {url} {
+ git "web--browse" $url
}
-unset browser doc_path doc_url
+
+.mbar.help add command -label [mc "Online Documentation"] \
+ -command [list start_browser $doc_url]
+
+.mbar.help add command -label [mc "Show SSH Key"] \
+ -command do_ssh_key
+
+unset doc_path doc_url
# -- Standard bindings
#
@@ -2743,7 +2772,7 @@ pack .vpane.lower.commarea.buttons.incall -side top -fill x
lappend disable_on_lock \
{.vpane.lower.commarea.buttons.incall conf -state}
-if {![is_enabled nocommit]} {
+if {![is_enabled nocommitmsg]} {
button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
-command do_signoff
pack .vpane.lower.commarea.buttons.signoff -side top -fill x
@@ -3261,8 +3290,7 @@ if {[is_enabled transport]} {
load_all_remotes
set n [.mbar.remote index end]
- populate_push_menu
- populate_fetch_menu
+ populate_remotes_menu
set n [expr {[.mbar.remote index end] - $n}]
if {$n > 0} {
if {[.mbar.remote type 0] eq "tearoff"} { incr n }
@@ -3369,3 +3397,6 @@ if {[is_enabled multicommit]} {
if {[is_enabled retcode]} {
bind . <Destroy> {+terminate_me %W}
}
+if {$picked && [is_config_true gui.autoexplore]} {
+ do_explore
+}