Skip to content

Commit

Permalink
Merge git://repo.or.cz/git-gui
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
Junio C Hamano committed Nov 2, 2008
2 parents 933bb3a + 9d83c6a commit f6576f4
Show file tree
Hide file tree
Showing 17 changed files with 1,080 additions and 190 deletions.
2 changes: 2 additions & 0 deletions git-gui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
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)$(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)'
Expand All @@ -302,6 +303,7 @@ endif
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)$(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)
Expand Down
59 changes: 59 additions & 0 deletions git-gui/git-gui--askpass
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh
# Tcl ignores the next line -*- tcl -*- \
exec wish "$0" -- "$@"

# This is a trivial implementation of an SSH_ASKPASS handler.
# Git-gui uses this script if none are already configured.

set answer {}
set yesno 0
set rc 255

if {$argc < 1} {
set prompt "Enter your OpenSSH passphrase:"
} else {
set prompt [join $argv " "]
if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {
set yesno 1
}
}

message .m -text $prompt -justify center -aspect 4000
pack .m -side top -fill x -padx 20 -pady 20 -expand 1

entry .e -textvariable answer -width 50
pack .e -side top -fill x -padx 10 -pady 10

if {!$yesno} {
.e configure -show "*"
}

frame .b
button .b.ok -text OK -command finish
button .b.cancel -text Cancel -command {destroy .}

pack .b.ok -side left -expand 1
pack .b.cancel -side right -expand 1
pack .b -side bottom -fill x -padx 10 -pady 10

bind . <Visibility> {focus -force .e}
bind . <Key-Return> finish
bind . <Key-Escape> {destroy .}
bind . <Destroy> {exit $rc}

proc finish {} {
if {$::yesno} {
if {$::answer ne "yes" && $::answer ne "no"} {
tk_messageBox -icon error -title "Error" -type ok \
-message "Only 'yes' or 'no' input allowed."
return
}
}

set ::rc 0
puts $::answer
destroy .
}

wm title . "OpenSSH"
tk::PlaceWindow .
89 changes: 60 additions & 29 deletions git-gui/git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
######################################################################
Expand Down Expand Up @@ -995,6 +1001,7 @@ citool {
##
## repository setup
set picked 0
if {[catch {
set _gitdir $env(GIT_DIR)
set _prefix {}
Expand All @@ -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]}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -2218,6 +2250,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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2446,12 +2483,16 @@ if {[is_enabled branch]} {
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
}
Expand Down Expand Up @@ -2487,43 +2528,31 @@ 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]
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
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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
}
Loading

0 comments on commit f6576f4

Please sign in to comment.