Skip to content
/ git Public
forked from git/git

Commit

Permalink
Merge git://repo.or.cz/git-gui
Browse files Browse the repository at this point in the history
* 'master' of git://repo.or.cz/git-gui:
  git-gui 0.13
  git-gui: avoid mis-encoding the copyright message on Windows.
  git-gui: Update Swedish translation (521t).
  git-gui: ensure correct application termination in git-gui--askpass
  git-gui: handle textconv filter on Windows and in development
  git-gui: use shell to launch textconv filter in "blame"
  git-gui: display error launching blame as a message box.
  git-gui: Make usage statement visible on Windows.
  • Loading branch information
gitster committed Sep 15, 2010
2 parents 5879b6b + 00e9de7 commit 12644fa
Show file tree
Hide file tree
Showing 6 changed files with 454 additions and 411 deletions.
2 changes: 1 addition & 1 deletion git-gui/GIT-VERSION-GEN
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

GVF=GIT-VERSION-FILE
DEF_VER=0.12.GITGUI
DEF_VER=0.13.GITGUI

LF='
'
Expand Down
1 change: 1 addition & 0 deletions git-gui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ endif
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
$(QUIET_GEN)rm -f $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
-e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
-e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
Expand Down
19 changes: 13 additions & 6 deletions git-gui/git-gui--askpass
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ exec wish "$0" -- "$@"
# This is a trivial implementation of an SSH_ASKPASS handler.
# Git-gui uses this script if none are already configured.

package require Tk

set answer {}
set yesno 0
set rc 255
Expand All @@ -30,16 +32,20 @@ if {!$yesno} {

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

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}
bind . <Key-Return> [list .b.ok invoke]
bind . <Key-Escape> [list .b.cancel invoke]
bind . <Destroy> {set rc $rc}

proc cancel {} {
set ::rc 255
}

proc finish {} {
if {$::yesno} {
Expand All @@ -50,10 +56,11 @@ proc finish {} {
}
}

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

wm title . "OpenSSH"
tk::PlaceWindow .
vwait rc
exit $rc
32 changes: 28 additions & 4 deletions git-gui/git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
exec wish "$argv0" -- "$@"

set appvers {@@GITGUI_VERSION@@}
set copyright [encoding convertfrom utf-8 {
Copyright © 2006, 2007 Shawn Pearce, et. al.
set copyright [string map [list (c) \u00a9] {
Copyright (c) 2006-2010 Shawn Pearce, et. al.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -128,6 +128,7 @@ set _githtmldir {}
set _reponame {}
set _iscygwin {}
set _search_path {}
set _shellpath {@@SHELL_PATH@@}

set _trace [lsearch -exact $argv --trace]
if {$_trace >= 0} {
Expand All @@ -137,6 +138,18 @@ if {$_trace >= 0} {
set _trace 0
}

proc shellpath {} {
global _shellpath env
if {[string match @@* $_shellpath]} {
if {[info exists env(SHELL)]} {
return $env(SHELL)
} else {
return /bin/sh
}
}
return $_shellpath
}

proc appname {} {
global _appname
return $_appname
Expand Down Expand Up @@ -2845,7 +2858,13 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
set subcommand_args {}
proc usage {} {
puts stderr "usage: $::argv0 $::subcommand $::subcommand_args"
set s "usage: $::argv0 $::subcommand $::subcommand_args"
if {[tk windowingsystem] eq "win32"} {
wm withdraw .
tk_messageBox -icon info -title "Usage" -message $s
} else {
puts stderr $s
}
exit 1
}
Expand Down Expand Up @@ -2938,7 +2957,12 @@ blame {
}
blame {
if {$head eq {} && ![file exists $path]} {
puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path]
catch {wm withdraw .}
tk_messageBox \
-icon error \
-type ok \
-title [mc "git-gui: fatal error"] \
-message [mc "fatal: cannot stat path %s: No such file or directory" $path]
exit 1
}
blame::new $head $path $jump_spec
Expand Down
9 changes: 8 additions & 1 deletion git-gui/lib/blame.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,14 @@ method _load {jump} {
}
if {$commit eq {}} {
if {$do_textconv ne 0} {
set fd [open |[list $textconv $path] r]
# Run textconv with sh -c "..." to allow it to
# contain command + arguments. On windows, just
# call the filter command.
if {![file executable [shellpath]]} {
set fd [open |[linsert $textconv end $path] r]
} else {
set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r]
}
} else {
set fd [open $path r]
}
Expand Down
Loading

0 comments on commit 12644fa

Please sign in to comment.