Skip to content

Commit 49613ee

Browse files
committed
Merge 'gitk' into HEAD
2 parents 5a27c29 + a56879a commit 49613ee

File tree

1 file changed

+62
-36
lines changed

1 file changed

+62
-36
lines changed

gitk-git/gitk

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ proc start_rev_list {view} {
406406
if {$revs eq {}} {
407407
return 0
408408
}
409-
set args [concat $vflags($view) $revs]
409+
set args [limit_arg_length [concat $vflags($view) $revs]]
410410
} else {
411411
set args $vorigargs($view)
412412
}
@@ -2076,7 +2076,7 @@ proc makewindow {} {
20762076
global headctxmenu progresscanv progressitem progresscoords statusw
20772077
global fprogitem fprogcoord lastprogupdate progupdatepending
20782078
global rprogitem rprogcoord rownumsel numcommits
2079-
global have_tk85 use_ttk NS
2079+
global have_tk85 have_tk86 use_ttk NS
20802080
global git_version
20812081
global worddiff
20822082

@@ -2566,8 +2566,13 @@ proc makewindow {} {
25662566
bind . <Key-Down> "selnextline 1"
25672567
bind . <Shift-Key-Up> "dofind -1 0"
25682568
bind . <Shift-Key-Down> "dofind 1 0"
2569-
bindkey <Key-Right> "goforw"
2570-
bindkey <Key-Left> "goback"
2569+
if {$have_tk86} {
2570+
bindkey <<NextChar>> "goforw"
2571+
bindkey <<PrevChar>> "goback"
2572+
} else {
2573+
bindkey <Key-Right> "goforw"
2574+
bindkey <Key-Left> "goback"
2575+
}
25712576
bind . <Key-Prior> "selnextpage -1"
25722577
bind . <Key-Next> "selnextpage 1"
25732578
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -7634,7 +7639,7 @@ proc gettreeline {gtf id} {
76347639
if {[string index $fname 0] eq "\""} {
76357640
set fname [lindex $fname 0]
76367641
}
7637-
set fname [encoding convertfrom $fname]
7642+
set fname [encoding convertfrom utf-8 $fname]
76387643
lappend treefilelist($id) $fname
76397644
}
76407645
if {![eof $gtf]} {
@@ -7896,7 +7901,7 @@ proc gettreediffline {gdtf ids} {
78967901
if {[string index $file 0] eq "\""} {
78977902
set file [lindex $file 0]
78987903
}
7899-
set file [encoding convertfrom $file]
7904+
set file [encoding convertfrom utf-8 $file]
79007905
if {$file ne [lindex $treediff end]} {
79017906
lappend treediff $file
79027907
lappend sublist $file
@@ -8041,7 +8046,7 @@ proc makediffhdr {fname ids} {
80418046
global ctext curdiffstart treediffs diffencoding
80428047
global ctext_file_names jump_to_here targetline diffline
80438048

8044-
set fname [encoding convertfrom $fname]
8049+
set fname [encoding convertfrom utf-8 $fname]
80458050
set diffencoding [get_path_encoding $fname]
80468051
set i [lsearch -exact $treediffs($ids) $fname]
80478052
if {$i >= 0} {
@@ -8103,7 +8108,7 @@ proc parseblobdiffline {ids line} {
81038108

81048109
if {![string compare -length 5 "diff " $line]} {
81058110
if {![regexp {^diff (--cc|--git) } $line m type]} {
8106-
set line [encoding convertfrom $line]
8111+
set line [encoding convertfrom utf-8 $line]
81078112
$ctext insert end "$line\n" hunksep
81088113
continue
81098114
}
@@ -8150,7 +8155,7 @@ proc parseblobdiffline {ids line} {
81508155
makediffhdr $fname $ids
81518156

81528157
} elseif {![string compare -length 16 "* Unmerged path " $line]} {
8153-
set fname [encoding convertfrom [string range $line 16 end]]
8158+
set fname [encoding convertfrom utf-8 [string range $line 16 end]]
81548159
$ctext insert end "\n"
81558160
set curdiffstart [$ctext index "end - 1c"]
81568161
lappend ctext_file_names $fname
@@ -8205,7 +8210,7 @@ proc parseblobdiffline {ids line} {
82058210
if {[string index $fname 0] eq "\""} {
82068211
set fname [lindex $fname 0]
82078212
}
8208-
set fname [encoding convertfrom $fname]
8213+
set fname [encoding convertfrom utf-8 $fname]
82098214
set i [lsearch -exact $treediffs($ids) $fname]
82108215
if {$i >= 0} {
82118216
setinlist difffilestart $i $curdiffstart
@@ -8224,6 +8229,7 @@ proc parseblobdiffline {ids line} {
82248229
set diffinhdr 0
82258230
return
82268231
}
8232+
set line [encoding convertfrom utf-8 $line]
82278233
$ctext insert end "$line\n" filesep
82288234

82298235
} else {
@@ -9982,7 +9988,7 @@ proc showrefs {} {
99829988
text $top.list -background $bgcolor -foreground $fgcolor \
99839989
-selectbackground $selectbgcolor -font mainfont \
99849990
-xscrollcommand "$top.xsb set" -yscrollcommand "$top.ysb set" \
9985-
-width 30 -height 20 -cursor $maincursor \
9991+
-width 60 -height 20 -cursor $maincursor \
99869992
-spacing1 1 -spacing3 1 -state disabled
99879993
$top.list tag configure highlight -background $selectbgcolor
99889994
if {![lsearch -exact $bglist $top.list]} {
@@ -10171,7 +10177,8 @@ proc getallcommits {} {
1017110177
}
1017210178
}
1017310179
if {$ids ne {}} {
10174-
set fd [open [concat $cmd $ids] r]
10180+
set cmd [limit_arg_length [concat $cmd $ids]]
10181+
set fd [open $cmd r]
1017510182
fconfigure $fd -blocking 0
1017610183
incr allcommits
1017710184
nowbusy allcommits
@@ -10181,6 +10188,21 @@ proc getallcommits {} {
1018110188
}
1018210189
}
1018310190

10191+
# The maximum command line length for the CreateProcess function is 32767 characters, see
10192+
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
10193+
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
10194+
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
10195+
proc limit_arg_length {cmd} {
10196+
if {[tk windowingsystem] == "win32" &&
10197+
[string length $cmd] > 32000} {
10198+
set ndx [string last " " $cmd 32000]
10199+
if {$ndx != -1} {
10200+
return [string range $cmd 0 $ndx]
10201+
}
10202+
}
10203+
return $cmd
10204+
}
10205+
1018410206
# Since most commits have 1 parent and 1 child, we group strings of
1018510207
# such commits into "arcs" joining branch/merge points (BMPs), which
1018610208
# are commits that either don't have 1 parent or don't have 1 child.
@@ -12161,7 +12183,7 @@ proc cache_gitattr {attr pathlist} {
1216112183
foreach row [split $rlist "\n"] {
1216212184
if {[regexp "(.*): $attr: (.*)" $row m path value]} {
1216312185
if {[string index $path 0] eq "\""} {
12164-
set path [encoding convertfrom [lindex $path 0]]
12186+
set path [encoding convertfrom utf-8 [lindex $path 0]]
1216512187
}
1216612188
set path_attr_cache($attr,$path) $value
1216712189
}
@@ -12191,7 +12213,6 @@ if { [info exists ::env(GITK_MSGSDIR)] } {
1219112213
set gitk_prefix [file dirname [file dirname [file normalize $argv0]]]
1219212214
set gitk_libdir [file join $gitk_prefix share gitk lib]
1219312215
set gitk_msgsdir [file join $gitk_libdir msgs]
12194-
unset gitk_prefix
1219512216
}
1219612217

1219712218
## Internationalization (i18n) through msgcat and gettext. See
@@ -12482,6 +12503,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1248212503
set nullfile "/dev/null"
1248312504

1248412505
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12506+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1248512507
if {![info exists have_ttk]} {
1248612508
set have_ttk [llength [info commands ::ttk::style]]
1248712509
}
@@ -12546,28 +12568,32 @@ if {[expr {[exec git rev-parse --is-inside-work-tree] == "true"}]} {
1254612568
set worktree [exec git rev-parse --show-toplevel]
1254712569
setcoords
1254812570
makewindow
12549-
catch {
12550-
image create photo gitlogo -width 16 -height 16
12551-
12552-
image create photo gitlogominus -width 4 -height 2
12553-
gitlogominus put #C00000 -to 0 0 4 2
12554-
gitlogo copy gitlogominus -to 1 5
12555-
gitlogo copy gitlogominus -to 6 5
12556-
gitlogo copy gitlogominus -to 11 5
12557-
image delete gitlogominus
12558-
12559-
image create photo gitlogoplus -width 4 -height 4
12560-
gitlogoplus put #008000 -to 1 0 3 4
12561-
gitlogoplus put #008000 -to 0 1 4 3
12562-
gitlogo copy gitlogoplus -to 1 9
12563-
gitlogo copy gitlogoplus -to 6 9
12564-
gitlogo copy gitlogoplus -to 11 9
12565-
image delete gitlogoplus
12566-
12567-
image create photo gitlogo32 -width 32 -height 32
12568-
gitlogo32 copy gitlogo -zoom 2 2
12569-
12570-
wm iconphoto . -default gitlogo gitlogo32
12571+
if {$::tcl_platform(platform) eq {windows} && [file exists $gitk_prefix/etc/git.ico]} {
12572+
wm iconbitmap . -default $gitk_prefix/etc/git.ico
12573+
} else {
12574+
catch {
12575+
image create photo gitlogo -width 16 -height 16
12576+
12577+
image create photo gitlogominus -width 4 -height 2
12578+
gitlogominus put #C00000 -to 0 0 4 2
12579+
gitlogo copy gitlogominus -to 1 5
12580+
gitlogo copy gitlogominus -to 6 5
12581+
gitlogo copy gitlogominus -to 11 5
12582+
image delete gitlogominus
12583+
12584+
image create photo gitlogoplus -width 4 -height 4
12585+
gitlogoplus put #008000 -to 1 0 3 4
12586+
gitlogoplus put #008000 -to 0 1 4 3
12587+
gitlogo copy gitlogoplus -to 1 9
12588+
gitlogo copy gitlogoplus -to 6 9
12589+
gitlogo copy gitlogoplus -to 11 9
12590+
image delete gitlogoplus
12591+
12592+
image create photo gitlogo32 -width 32 -height 32
12593+
gitlogo32 copy gitlogo -zoom 2 2
12594+
12595+
wm iconphoto . -default gitlogo gitlogo32
12596+
}
1257112597
}
1257212598
# wait for the window to become visible
1257312599
tkwait visibility .

0 commit comments

Comments
 (0)