Skip to content

Commit 834caf9

Browse files
committed
Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Force the focus to the main window on Windows gitk: Allow unbalanced quotes/braces in commit headers gitk: Update German translation gitk: Mark forgotten strings (header sentence parts in color chooser) for translation gitk: Ensure that "Reset branch" menu entry is enabled gitk: Use check-buttons' -text property instead of separate labels gitk: Map / to focus the search box gitk: Fix bugs in blaming code
2 parents b3eae84 + e4df519 commit 834caf9

File tree

2 files changed

+213
-63
lines changed

2 files changed

+213
-63
lines changed

gitk-git/gitk

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,13 +1601,14 @@ proc parsecommit {id contents listed} {
16011601
set header [string range $contents 0 [expr {$hdrend - 1}]]
16021602
set comment [string range $contents [expr {$hdrend + 2}] end]
16031603
foreach line [split $header "\n"] {
1604+
set line [split $line " "]
16041605
set tag [lindex $line 0]
16051606
if {$tag == "author"} {
16061607
set audate [lindex $line end-1]
1607-
set auname [lrange $line 1 end-2]
1608+
set auname [join [lrange $line 1 end-2] " "]
16081609
} elseif {$tag == "committer"} {
16091610
set comdate [lindex $line end-1]
1610-
set comname [lrange $line 1 end-2]
1611+
set comname [join [lrange $line 1 end-2] " "]
16111612
}
16121613
}
16131614
set headline {}
@@ -2279,7 +2280,7 @@ proc makewindow {} {
22792280
bindkey b prevfile
22802281
bindkey d "$ctext yview scroll 18 units"
22812282
bindkey u "$ctext yview scroll -18 units"
2282-
bindkey / {dofind 1 1}
2283+
bindkey / {focus $fstring}
22832284
bindkey <Key-Return> {dofind 1 1}
22842285
bindkey ? {dofind -1 1}
22852286
bindkey f nextfile
@@ -2660,7 +2661,7 @@ proc keys {} {
26602661
[mc "<%s-F> Find" $M1T]
26612662
[mc "<%s-G> Move to next find hit" $M1T]
26622663
[mc "<Return> Move to next find hit"]
2663-
[mc "/ Move to next find hit, or redo find"]
2664+
[mc "/ Focus the search box"]
26642665
[mc "? Move to previous find hit"]
26652666
[mc "f Scroll diff view to next file"]
26662667
[mc "<%s-S> Search for next hit in diff view" $M1T]
@@ -3318,8 +3319,27 @@ proc index_sha1 {fname} {
33183319
return {}
33193320
}
33203321

3322+
# Turn an absolute path into one relative to the current directory
3323+
proc make_relative {f} {
3324+
set elts [file split $f]
3325+
set here [file split [pwd]]
3326+
set ei 0
3327+
set hi 0
3328+
set res {}
3329+
foreach d $here {
3330+
if {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} {
3331+
lappend res ".."
3332+
} else {
3333+
incr ei
3334+
}
3335+
incr hi
3336+
}
3337+
set elts [concat $res [lrange $elts $ei end]]
3338+
return [eval file join $elts]
3339+
}
3340+
33213341
proc external_blame {parent_idx {line {}}} {
3322-
global flist_menu_file
3342+
global flist_menu_file gitdir
33233343
global nullid nullid2
33243344
global parentlist selectedline currentid
33253345

@@ -3338,7 +3358,12 @@ proc external_blame {parent_idx {line {}}} {
33383358
if {$line ne {} && $line > 1} {
33393359
lappend cmdline "--line=$line"
33403360
}
3341-
lappend cmdline $base_commit $flist_menu_file
3361+
set f [file join [file dirname $gitdir] $flist_menu_file]
3362+
# Unfortunately it seems git gui blame doesn't like
3363+
# being given an absolute path...
3364+
set f [make_relative $f]
3365+
lappend cmdline $base_commit $f
3366+
puts "cmdline={$cmdline}"
33423367
if {[catch {eval exec $cmdline &} err]} {
33433368
error_popup "[mc "git gui blame: command failed:"] $err"
33443369
}
@@ -3382,6 +3407,8 @@ proc show_line_source {} {
33823407
error_popup [mc "Error reading index: %s" $err]
33833408
return
33843409
}
3410+
} else {
3411+
set id $parents($curview,$currentid)
33853412
}
33863413
} else {
33873414
set id [lindex $parents($curview,$currentid) $pi]
@@ -3398,7 +3425,7 @@ proc show_line_source {} {
33983425
} else {
33993426
lappend blameargs $id
34003427
}
3401-
lappend blameargs -- $flist_menu_file
3428+
lappend blameargs -- [file join [file dirname $gitdir] $flist_menu_file]
34023429
if {[catch {
34033430
set f [open $blameargs r]
34043431
} err]} {
@@ -7953,7 +7980,7 @@ proc rowmenu {x y id} {
79537980
if {$id ne $nullid && $id ne $nullid2} {
79547981
set menu $rowctxmenu
79557982
if {$mainhead ne {}} {
7956-
$menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
7983+
$menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] -state normal
79577984
} else {
79587985
$menu entryconfigure 7 -label [mc "Detached head: can't reset" $mainhead] -state disabled
79597986
}
@@ -10079,36 +10106,26 @@ proc doprefs {} {
1007910106
-font optionfont
1008010107
spinbox $top.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct
1008110108
grid x $top.maxpctl $top.maxpct -sticky w
10082-
frame $top.showlocal
10083-
label $top.showlocal.l -text [mc "Show local changes"] -font optionfont
10084-
checkbutton $top.showlocal.b -variable showlocalchanges
10085-
pack $top.showlocal.b $top.showlocal.l -side left
10109+
checkbutton $top.showlocal -text [mc "Show local changes"] \
10110+
-font optionfont -variable showlocalchanges
1008610111
grid x $top.showlocal -sticky w
10087-
frame $top.autoselect
10088-
label $top.autoselect.l -text [mc "Auto-select SHA1"] -font optionfont
10089-
checkbutton $top.autoselect.b -variable autoselect
10090-
pack $top.autoselect.b $top.autoselect.l -side left
10112+
checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
10113+
-font optionfont -variable autoselect
1009110114
grid x $top.autoselect -sticky w
1009210115

1009310116
label $top.ddisp -text [mc "Diff display options"]
1009410117
grid $top.ddisp - -sticky w -pady 10
1009510118
label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
1009610119
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
1009710120
grid x $top.tabstopl $top.tabstop -sticky w
10098-
frame $top.ntag
10099-
label $top.ntag.l -text [mc "Display nearby tags"] -font optionfont
10100-
checkbutton $top.ntag.b -variable showneartags
10101-
pack $top.ntag.b $top.ntag.l -side left
10121+
checkbutton $top.ntag -text [mc "Display nearby tags"] \
10122+
-font optionfont -variable showneartags
1010210123
grid x $top.ntag -sticky w
10103-
frame $top.ldiff
10104-
label $top.ldiff.l -text [mc "Limit diffs to listed paths"] -font optionfont
10105-
checkbutton $top.ldiff.b -variable limitdiffs
10106-
pack $top.ldiff.b $top.ldiff.l -side left
10124+
checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
10125+
-font optionfont -variable limitdiffs
1010710126
grid x $top.ldiff -sticky w
10108-
frame $top.lattr
10109-
label $top.lattr.l -text [mc "Support per-file encodings"] -font optionfont
10110-
checkbutton $top.lattr.b -variable perfile_attrs
10111-
pack $top.lattr.b $top.lattr.l -side left
10127+
checkbutton $top.lattr -text [mc "Support per-file encodings"] \
10128+
-font optionfont -variable perfile_attrs
1011210129
grid x $top.lattr -sticky w
1011310130

1011410131
entry $top.extdifft -textvariable extdifftool
@@ -10124,26 +10141,26 @@ proc doprefs {} {
1012410141
grid $top.cdisp - -sticky w -pady 10
1012510142
label $top.bg -padx 40 -relief sunk -background $bgcolor
1012610143
button $top.bgbut -text [mc "Background"] -font optionfont \
10127-
-command [list choosecolor bgcolor {} $top.bg background setbg]
10144+
-command [list choosecolor bgcolor {} $top.bg [mc "background"] setbg]
1012810145
grid x $top.bgbut $top.bg -sticky w
1012910146
label $top.fg -padx 40 -relief sunk -background $fgcolor
1013010147
button $top.fgbut -text [mc "Foreground"] -font optionfont \
10131-
-command [list choosecolor fgcolor {} $top.fg foreground setfg]
10148+
-command [list choosecolor fgcolor {} $top.fg [mc "foreground"] setfg]
1013210149
grid x $top.fgbut $top.fg -sticky w
1013310150
label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
1013410151
button $top.diffoldbut -text [mc "Diff: old lines"] -font optionfont \
10135-
-command [list choosecolor diffcolors 0 $top.diffold "diff old lines" \
10152+
-command [list choosecolor diffcolors 0 $top.diffold [mc "diff old lines"] \
1013610153
[list $ctext tag conf d0 -foreground]]
1013710154
grid x $top.diffoldbut $top.diffold -sticky w
1013810155
label $top.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]
1013910156
button $top.diffnewbut -text [mc "Diff: new lines"] -font optionfont \
10140-
-command [list choosecolor diffcolors 1 $top.diffnew "diff new lines" \
10157+
-command [list choosecolor diffcolors 1 $top.diffnew [mc "diff new lines"] \
1014110158
[list $ctext tag conf dresult -foreground]]
1014210159
grid x $top.diffnewbut $top.diffnew -sticky w
1014310160
label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
1014410161
button $top.hunksepbut -text [mc "Diff: hunk header"] -font optionfont \
1014510162
-command [list choosecolor diffcolors 2 $top.hunksep \
10146-
"diff hunk header" \
10163+
[mc "diff hunk header"] \
1014710164
[list $ctext tag conf hunksep -foreground]]
1014810165
grid x $top.hunksepbut $top.hunksep -sticky w
1014910166
label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor
@@ -10154,7 +10171,7 @@ proc doprefs {} {
1015410171
grid x $top.markbgbut $top.markbgsep -sticky w
1015510172
label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor
1015610173
button $top.selbgbut -text [mc "Select bg"] -font optionfont \
10157-
-command [list choosecolor selectbgcolor {} $top.selbgsep background setselbg]
10174+
-command [list choosecolor selectbgcolor {} $top.selbgsep [mc "background"] setselbg]
1015810175
grid x $top.selbgbut $top.selbgsep -sticky w
1015910176

1016010177
label $top.cfont -text [mc "Fonts: press to choose"]
@@ -10897,4 +10914,9 @@ if {[info exists permviews]} {
1089710914
addviewmenu $n
1089810915
}
1089910916
}
10917+
10918+
if {[tk windowingsystem] eq "win32"} {
10919+
focus -force .
10920+
}
10921+
1090010922
getcommits {}

0 commit comments

Comments
 (0)