Permalink
Browse files

Merge branch 'master' of git://repo.or.cz/git-gui

* 'master' of git://repo.or.cz/git-gui: (28 commits)
  git-gui 0.16
  git-gui: handle shell script text filters when loading for blame.
  git-gui: Set both 16x16 and 32x32 icons on X to pacify Xming.
  git-gui: added config gui.gcwarning to disable the gc hint message
  git-gui: set whitespace warnings appropriate to this project
  git-gui: don't warn for detached head when rebasing
  git-gui: make config gui.warndetachedcommit a boolean
  git-gui: add config value gui.diffopts for passing additional diff options
  git-gui: sort the numeric ansi codes
  git-gui: support underline style when parsing diff output
  git-gui: fix spelling error in sshkey.tcl
  git-gui: include the file path in guitools confirmation dialog
  git-gui: span widgets over the full file output area in the blame view
  git-gui: use a tristate to control the case mode in the searchbar
  git-gui: set suitable extended window manager hints.
  git-gui: fix display of path in browser title
  git-gui: enable the smart case sensitive search only if gui.search.smartcase is true
  git-gui: catch invalid or complete regular expressions and treat as no match.
  git-gui: theme the search and line-number entry fields on blame screen
  git-gui: include the number of untracked files to stage when asking the user
  ...
  • Loading branch information...
gitster committed Dec 14, 2011
2 parents 57526fd + 942e6ba commit 73c6b3575bc638b7096ec913bd91193707e2265d
View
@@ -1,3 +1,4 @@
* whitespace=indent-with-non-tab,trailing-space,space-before-tab,tabwidth=4
* encoding=US-ASCII * encoding=US-ASCII
git-gui.sh encoding=UTF-8 git-gui.sh encoding=UTF-8
/po/*.po encoding=UTF-8 /po/*.po encoding=UTF-8
View
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
GVF=GIT-VERSION-FILE GVF=GIT-VERSION-FILE
DEF_VER=0.13.GITGUI DEF_VER=0.16.GITGUI
LF=' LF='
' '
View
@@ -299,7 +299,9 @@ proc is_config_true {name} {
global repo_config global repo_config
if {[catch {set v $repo_config($name)}]} { if {[catch {set v $repo_config($name)}]} {
return 0 return 0
} elseif {$v eq {true} || $v eq {1} || $v eq {yes}} { }
set v [string tolower $v]
if {$v eq {} || $v eq {true} || $v eq {1} || $v eq {yes} || $v eq {on}} {
return 1 return 1
} else { } else {
return 0 return 0
@@ -310,7 +312,9 @@ proc is_config_false {name} {
global repo_config global repo_config
if {[catch {set v $repo_config($name)}]} { if {[catch {set v $repo_config($name)}]} {
return 0 return 0
} elseif {$v eq {false} || $v eq {0} || $v eq {no}} { }
set v [string tolower $v]
if {$v eq {false} || $v eq {0} || $v eq {no} || $v eq {off}} {
return 1 return 1
} else { } else {
return 0 return 0
@@ -460,6 +464,35 @@ proc _which {what args} {
return {} return {}
} }
# Test a file for a hashbang to identify executable scripts on Windows.
proc is_shellscript {filename} {
if {![file exists $filename]} {return 0}
set f [open $filename r]
fconfigure $f -encoding binary
set magic [read $f 2]
close $f
return [expr {$magic eq "#!"}]
}
# Run a command connected via pipes on stdout.
# This is for use with textconv filters and uses sh -c "..." to allow it to
# contain a command with arguments. On windows we must check for shell
# scripts specifically otherwise just call the filter command.
proc open_cmd_pipe {cmd path} {
global env
if {![file executable [shellpath]]} {
set exe [auto_execok [lindex $cmd 0]]
if {[is_shellscript [lindex $exe 0]]} {
set run [linsert [auto_execok sh] end -c "$cmd \"\$0\"" $path]
} else {
set run [concat $exe [lrange $cmd 1 end] $path]
}
} else {
set run [list [shellpath] -c "$cmd \"\$0\"" $path]
}
return [open |$run r]
}
proc _lappend_nice {cmd_var} { proc _lappend_nice {cmd_var} {
global _nice global _nice
upvar $cmd_var cmd upvar $cmd_var cmd
@@ -725,7 +758,10 @@ if {[is_Windows]} {
gitlogo put gray26 -to 5 15 11 16 gitlogo put gray26 -to 5 15 11 16
gitlogo redither gitlogo redither
wm iconphoto . -default gitlogo image create photo gitlogo32 -width 32 -height 32
gitlogo32 copy gitlogo -zoom 2 2
wm iconphoto . -default gitlogo gitlogo32
} }
} }
@@ -846,6 +882,7 @@ set default_config(gui.fastcopyblame) false
set default_config(gui.copyblamethreshold) 40 set default_config(gui.copyblamethreshold) 40
set default_config(gui.blamehistoryctx) 7 set default_config(gui.blamehistoryctx) 7
set default_config(gui.diffcontext) 5 set default_config(gui.diffcontext) 5
set default_config(gui.diffopts) {}
set default_config(gui.commitmsgwidth) 75 set default_config(gui.commitmsgwidth) 75
set default_config(gui.newbranchtemplate) {} set default_config(gui.newbranchtemplate) {}
set default_config(gui.spellingdictionary) {} set default_config(gui.spellingdictionary) {}
@@ -859,6 +896,7 @@ set font_descs {
{fontui font_ui {mc "Main Font"}} {fontui font_ui {mc "Main Font"}}
{fontdiff font_diff {mc "Diff/Console Font"}} {fontdiff font_diff {mc "Diff/Console Font"}}
} }
set default_config(gui.stageuntracked) ask
###################################################################### ######################################################################
## ##
@@ -1060,6 +1098,10 @@ git-version proc _parse_config {arr_name args} {
} else { } else {
set arr($name) $value set arr($name) $value
} }
} elseif {[regexp {^([^\n]+)$} $line line name]} {
# no value given, but interpreting them as
# boolean will be handled as true
set arr($name) {}
} }
} }
} }
@@ -1075,6 +1117,10 @@ git-version proc _parse_config {arr_name args} {
} else { } else {
set arr($name) $value set arr($name) $value
} }
} elseif {[regexp {^([^=]+)$} $line line name]} {
# no value given, but interpreting them as
# boolean will be handled as true
set arr($name) {}
} }
} }
close $fd_rc close $fd_rc
@@ -2474,6 +2520,7 @@ proc toggle_or_diff {w x y} {
[concat $after [list ui_ready]] [concat $after [list ui_ready]]
} }
} else { } else {
set selected_paths($path) 1
show_diff $path $w $lno show_diff $path $w $lno
} }
} }
@@ -3362,6 +3409,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
$ui_diff tag configure clri3$n -background $c $ui_diff tag configure clri3$n -background $c
} }
$ui_diff tag configure clr1 -font font_diffbold $ui_diff tag configure clr1 -font font_diffbold
$ui_diff tag configure clr4 -underline 1
$ui_diff tag conf d_info -foreground blue -font font_diffbold $ui_diff tag conf d_info -foreground blue -font font_diffbold
@@ -3878,7 +3926,7 @@ after 1 {
$ui_comm configure -state disabled -background gray $ui_comm configure -state disabled -background gray
} }
} }
if {[is_enabled multicommit]} { if {[is_enabled multicommit] && ![is_config_false gui.gcwarning]} {
after 1000 hint_gc after 1000 hint_gc
} }
if {[is_enabled retcode]} { if {[is_enabled retcode]} {
View
@@ -219,7 +219,8 @@ constructor new {i_commit i_path i_jump} {
eval grid $w_columns $w.file_pane.out.sby -sticky nsew eval grid $w_columns $w.file_pane.out.sby -sticky nsew
grid conf \ grid conf \
$w.file_pane.out.sbx \ $w.file_pane.out.sbx \
-column [expr {[llength $w_columns] - 1}] \ -column 0 \
-columnspan [expr {[llength $w_columns] + 1}] \
-sticky we -sticky we
grid columnconfigure \ grid columnconfigure \
$w.file_pane.out \ $w.file_pane.out \
@@ -229,12 +230,14 @@ constructor new {i_commit i_path i_jump} {
set finder [::searchbar::new \ set finder [::searchbar::new \
$w.file_pane.out.ff $w_file \ $w.file_pane.out.ff $w_file \
-column [expr {[llength $w_columns] - 1}] \ -column 0 \
-columnspan [expr {[llength $w_columns] + 1}] \
] ]
set gotoline [::linebar::new \ set gotoline [::linebar::new \
$w.file_pane.out.lf $w_file \ $w.file_pane.out.lf $w_file \
-column [expr {[llength $w_columns] - 1}] \ -column 0 \
-columnspan [expr {[llength $w_columns] + 1}] \
] ]
set w_cviewer $w.file_pane.cm.t set w_cviewer $w.file_pane.cm.t
@@ -473,14 +476,7 @@ method _load {jump} {
} }
if {$commit eq {}} { if {$commit eq {}} {
if {$do_textconv ne 0} { if {$do_textconv ne 0} {
# Run textconv with sh -c "..." to allow it to set fd [open_cmd_pipe $textconv $path]
# 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 { } else {
set fd [open $path r] set fd [open $path r]
} }
@@ -572,7 +568,11 @@ method _read_file {fd jump} {
foreach i $w_columns {$i conf -state disabled} foreach i $w_columns {$i conf -state disabled}
if {[eof $fd]} { if {[eof $fd]} {
close $fd fconfigure $fd -blocking 1; # enable error reporting on close
if {[catch {close $fd} err]} {
tk_messageBox -icon error -title [mc Error] \
-message $err
}
# If we don't force Tk to update the widgets *right now* # If we don't force Tk to update the widgets *right now*
# none of our jump commands will cause a change in the UI. # none of our jump commands will cause a change in the UI.
@@ -1062,7 +1062,7 @@ method _gitkcommit {} {
set radius [get_config gui.blamehistoryctx] set radius [get_config gui.blamehistoryctx]
set cmdline [list --select-commit=$cmit] set cmdline [list --select-commit=$cmit]
if {$radius > 0} { if {$radius > 0} {
set author_time {} set author_time {}
set committer_time {} set committer_time {}
@@ -1170,7 +1170,7 @@ method _read_diff_load_commit {fd cparent new_path tline} {
} }
if {[eof $fd]} { if {[eof $fd]} {
close $fd; close $fd
set current_fd {} set current_fd {}
_load_new_commit $this \ _load_new_commit $this \
@@ -1201,6 +1201,7 @@ method _open_tooltip {cur_w} {
_hide_tooltip $this _hide_tooltip $this
set tooltip_wm [toplevel $cur_w.tooltip -borderwidth 1] set tooltip_wm [toplevel $cur_w.tooltip -borderwidth 1]
catch {wm attributes $tooltip_wm -type tooltip}
wm overrideredirect $tooltip_wm 1 wm overrideredirect $tooltip_wm 1
wm transient $tooltip_wm [winfo toplevel $cur_w] wm transient $tooltip_wm [winfo toplevel $cur_w]
set tooltip_t $tooltip_wm.label set tooltip_t $tooltip_wm.label
View
@@ -26,8 +26,14 @@ constructor new {commit {path {}}} {
wm withdraw $top wm withdraw $top
wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]] wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]]
if {$path ne {}} {
if {[string index $path end] ne {/}} {
append path /
}
}
set browser_commit $commit set browser_commit $commit
set browser_path $browser_commit:$path set browser_path "$browser_commit:[escape_path $path]"
${NS}::label $w.path \ ${NS}::label $w.path \
-textvariable @browser_path \ -textvariable @browser_path \
@@ -497,6 +497,7 @@ method _open_tooltip {} {
if {$tooltip_wm eq {}} { if {$tooltip_wm eq {}} {
set tooltip_wm [toplevel $w_list.tooltip -borderwidth 1] set tooltip_wm [toplevel $w_list.tooltip -borderwidth 1]
catch {wm attributes $tooltip_wm -type tooltip}
wm overrideredirect $tooltip_wm 1 wm overrideredirect $tooltip_wm 1
wm transient $tooltip_wm [winfo toplevel $w_list] wm transient $tooltip_wm [winfo toplevel $w_list]
set tooltip_t $tooltip_wm.label set tooltip_t $tooltip_wm.label
View
@@ -138,6 +138,7 @@ proc make_dialog {t w args} {
upvar $t top $w pfx this this upvar $t top $w pfx this this
global use_ttk global use_ttk
uplevel [linsert $args 0 make_toplevel $t $w] uplevel [linsert $args 0 make_toplevel $t $w]
catch {wm attributes $top -type dialog}
pave_toplevel $pfx pave_toplevel $pfx
} }
View
@@ -263,7 +263,9 @@ proc commit_commitmsg {curHEAD msg_p} {
global is_detached repo_config global is_detached repo_config
global pch_error global pch_error
if {$is_detached && $repo_config(gui.warndetachedcommit)} { if {$is_detached
&& ![file exists [gitdir rebase-merge head-name]]
&& [is_config_true gui.warndetachedcommit]} {
set msg [mc "You are about to commit on a detached head.\ set msg [mc "You are about to commit on a detached head.\
This is a potentially dangerous thing to do because if you switch\ This is a potentially dangerous thing to do because if you switch\
to another branch you will loose your changes and it can be difficult\ to another branch you will loose your changes and it can be difficult\
View
@@ -309,6 +309,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
lappend cmd -p lappend cmd -p
lappend cmd --color lappend cmd --color
set cmd [concat $cmd $repo_config(gui.diffopts)]
if {$repo_config(gui.diffcontext) >= 1} { if {$repo_config(gui.diffcontext) >= 1} {
lappend cmd "-U$repo_config(gui.diffcontext)" lappend cmd "-U$repo_config(gui.diffcontext)"
} }
@@ -502,9 +503,9 @@ proc read_diff {fd conflict_size cont_info} {
foreach {posbegin colbegin posend colend} $markup { foreach {posbegin colbegin posend colend} $markup {
set prefix clr set prefix clr
foreach style [split $colbegin ";"] { foreach style [lsort -integer [split $colbegin ";"]] {
if {$style eq "7"} {append prefix i; continue} if {$style eq "7"} {append prefix i; continue}
if {$style < 30 || $style > 47} {continue} if {$style != 4 && ($style < 30 || $style > 47)} {continue}
set a "$mark linestart + $posbegin chars" set a "$mark linestart + $posbegin chars"
set b "$mark linestart + $posend chars" set b "$mark linestart + $posend chars"
catch {$ui_diff tag add $prefix$style $a $b} catch {$ui_diff tag add $prefix$style $a $b}
View
@@ -356,21 +356,33 @@ proc do_add_all {} {
global file_states global file_states
set paths [list] set paths [list]
set unknown_paths [list] set untracked_paths [list]
foreach path [array names file_states] { foreach path [array names file_states] {
switch -glob -- [lindex $file_states($path) 0] { switch -glob -- [lindex $file_states($path) 0] {
U? {continue} U? {continue}
?M - ?M -
?T - ?T -
?D {lappend paths $path} ?D {lappend paths $path}
?O {lappend unknown_paths $path} ?O {lappend untracked_paths $path}
} }
} }
if {[llength $unknown_paths]} { if {[llength $untracked_paths]} {
set reply [ask_popup [mc "There are unknown files do you also want set reply 0
to stage those?"]] switch -- [get_config gui.stageuntracked] {
no {
set reply 0
}
yes {
set reply 1
}
ask -
default {
set reply [ask_popup [mc "Stage %d untracked files?" \
[llength $untracked_paths]]]
}
}
if {$reply} { if {$reply} {
set paths [concat $paths $unknown_paths] set paths [concat $paths $untracked_paths]
} }
} }
add_helper {Adding all changed files} $paths add_helper {Adding all changed files} $paths
View
@@ -15,7 +15,7 @@ constructor new {i_w i_text args} {
${NS}::frame $w ${NS}::frame $w
${NS}::label $w.l -text [mc "Goto Line:"] ${NS}::label $w.l -text [mc "Goto Line:"]
entry $w.ent \ tentry $w.ent \
-textvariable ${__this}::linenum \ -textvariable ${__this}::linenum \
-background lightgreen \ -background lightgreen \
-validate key \ -validate key \
View
@@ -153,9 +153,12 @@ proc do_options {} {
{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}} {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}} {i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
{i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}} {i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
{t gui.diffopts {mc "Additional Diff Parameters"}}
{i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}} {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
{t gui.newbranchtemplate {mc "New Branch Name Template"}} {t gui.newbranchtemplate {mc "New Branch Name Template"}}
{c gui.encoding {mc "Default File Contents Encoding"}} {c gui.encoding {mc "Default File Contents Encoding"}}
{b gui.warndetachedcommit {mc "Warn before committing to a detached head"}}
{s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
} { } {
set type [lindex $option 0] set type [lindex $option 0]
set name [lindex $option 1] set name [lindex $option 1]
@@ -208,6 +211,23 @@ proc do_options {} {
} }
pack $w.$f.$optid -side top -anchor w -fill x pack $w.$f.$optid -side top -anchor w -fill x
} }
s {
set opts [eval [lindex $option 3]]
${NS}::frame $w.$f.$optid
${NS}::label $w.$f.$optid.l -text "$text:"
if {$use_ttk} {
ttk::combobox $w.$f.$optid.v \
-textvariable ${f}_config_new($name) \
-values $opts -state readonly
} else {
eval tk_optionMenu $w.$f.$optid.v \
${f}_config_new($name) \
$opts
}
pack $w.$f.$optid.l -side left -anchor w -fill x
pack $w.$f.$optid.v -side right -anchor e -padx 5
pack $w.$f.$optid -side top -anchor w -fill x
}
} }
} }
} }
Oops, something went wrong.

0 comments on commit 73c6b35

Please sign in to comment.