Skip to content

Commit ea0e524

Browse files
committed
Merge early parts from git://ozlabs.org/~paulus/gitk.git
* master~2: gitk: Show staged submodules regardless of ignore config gitk: Allow displaying time zones from author and commit dates timestamps gitk: Switch to patch mode when searching for line origin gitk: Replace SHA1 entry field on keyboard paste l10n: Init Vietnamese translation
2 parents ad1c660 + 17f9836 commit ea0e524

File tree

2 files changed

+1391
-6
lines changed

2 files changed

+1391
-6
lines changed

gitk-git/gitk

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,7 @@ proc makewindow {} {
25852585
bind $fstring <Key-Return> {dofind 1 1}
25862586
bind $sha1entry <Key-Return> {gotocommit; break}
25872587
bind $sha1entry <<PasteSelection>> clearsha1
2588+
bind $sha1entry <<Paste>> clearsha1
25882589
bind $cflist <1> {sel_flist %W %x %y; break}
25892590
bind $cflist <B1-Motion> {sel_flist %W %x %y; break}
25902591
bind $cflist <ButtonRelease-1> {treeclick %W %x %y}
@@ -3870,7 +3871,7 @@ proc read_line_source {fd inst} {
38703871
set id $nullid2
38713872
}
38723873
if {[commitinview $id $curview]} {
3873-
selectline [rowofcommit $id] 1 [list $fname $lnum]
3874+
selectline [rowofcommit $id] 1 [list $fname $lnum] 1
38743875
} else {
38753876
error_popup [mc "That line comes from commit %s, \
38763877
which is not in this view" [shortids $id]]
@@ -5205,11 +5206,15 @@ proc dohidelocalchanges {} {
52055206
# spawn off a process to do git diff-index --cached HEAD
52065207
proc dodiffindex {} {
52075208
global lserial showlocalchanges vfilelimit curview
5208-
global hasworktree
5209+
global hasworktree git_version
52095210

52105211
if {!$showlocalchanges || !$hasworktree} return
52115212
incr lserial
5212-
set cmd "|git diff-index --cached HEAD"
5213+
if {[package vcompare $git_version "1.7.2"] >= 0} {
5214+
set cmd "|git diff-index --cached --ignore-submodules=dirty HEAD"
5215+
} else {
5216+
set cmd "|git diff-index --cached HEAD"
5217+
}
52135218
if {$vfilelimit($curview) ne {}} {
52145219
set cmd [concat $cmd -- $vfilelimit($curview)]
52155220
}
@@ -7161,7 +7166,7 @@ proc make_idmark {id} {
71617166
$canv raise $t
71627167
}
71637168

7164-
proc selectline {l isnew {desired_loc {}}} {
7169+
proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
71657170
global canv ctext commitinfo selectedline
71667171
global canvy0 linespc parents children curview
71677172
global currentid sha1entry
@@ -7187,6 +7192,10 @@ proc selectline {l isnew {desired_loc {}}} {
71877192
setcanvscroll
71887193
}
71897194

7195+
if {$cmitmode ne "patch" && $switch_to_patch} {
7196+
set cmitmode "patch"
7197+
}
7198+
71907199
set y [expr {$canvy0 + $l * $linespc}]
71917200
set ymax [lindex [$canv cget -scrollregion] 3]
71927201
set ytop [expr {$y - $linespc - 1}]
@@ -7705,7 +7714,7 @@ proc addtocflist {ids} {
77057714
}
77067715

77077716
proc diffcmd {ids flags} {
7708-
global log_showroot nullid nullid2
7717+
global log_showroot nullid nullid2 git_version
77097718

77107719
set i [lsearch -exact $ids $nullid]
77117720
set j [lsearch -exact $ids $nullid2]
@@ -7726,6 +7735,9 @@ proc diffcmd {ids flags} {
77267735
}
77277736
}
77287737
} elseif {$j >= 0} {
7738+
if {[package vcompare $git_version "1.7.2"] >= 0} {
7739+
set flags "$flags --ignore-submodules=dirty"
7740+
}
77297741
set cmd [concat | git diff-index --cached $flags]
77307742
if {[llength $ids] > 1} {
77317743
# comparing index with specific revision
@@ -11575,7 +11587,29 @@ proc prefsok {} {
1157511587
proc formatdate {d} {
1157611588
global datetimeformat
1157711589
if {$d ne {}} {
11578-
set d [clock format [lindex $d 0] -format $datetimeformat]
11590+
# If $datetimeformat includes a timezone, display in the
11591+
# timezone of the argument. Otherwise, display in local time.
11592+
if {[string match {*%[zZ]*} $datetimeformat]} {
11593+
if {[catch {set d [clock format [lindex $d 0] -timezone [lindex $d 1] -format $datetimeformat]}]} {
11594+
# Tcl < 8.5 does not support -timezone. Emulate it by
11595+
# setting TZ (e.g. TZ=<-0430>+04:30).
11596+
global env
11597+
if {[info exists env(TZ)]} {
11598+
set savedTZ $env(TZ)
11599+
}
11600+
set zone [lindex $d 1]
11601+
set sign [string map {+ - - +} [string index $zone 0]]
11602+
set env(TZ) <$zone>$sign[string range $zone 1 2]:[string range $zone 3 4]
11603+
set d [clock format [lindex $d 0] -format $datetimeformat]
11604+
if {[info exists savedTZ]} {
11605+
set env(TZ) $savedTZ
11606+
} else {
11607+
unset env(TZ)
11608+
}
11609+
}
11610+
} else {
11611+
set d [clock format [lindex $d 0] -format $datetimeformat]
11612+
}
1157911613
}
1158011614
return $d
1158111615
}

0 commit comments

Comments
 (0)