Skip to content

Commit 1d7d6ad

Browse files
committed
Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Parse arbitrary commit-ish in SHA1 field gitk: Fix direction of symmetric difference in optimized mode gitk: New option to hide remote refs gitk: Do not hard-code "encoding" in attribute lookup functions
2 parents b2139db + 9bf3acf commit 1d7d6ad

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

gitk-git/gitk

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ proc parseviewrevs {view revs} {
288288
if {$sdm != 2} {
289289
lappend ret $id
290290
} else {
291-
lset ret end [lindex $ret end]...$id
291+
lset ret end $id...[lindex $ret end]
292292
}
293293
lappend pos $id
294294
}
@@ -1677,6 +1677,7 @@ proc readrefs {} {
16771677
global tagids idtags headids idheads tagobjid
16781678
global otherrefids idotherrefs mainhead mainheadid
16791679
global selecthead selectheadid
1680+
global hideremotes
16801681

16811682
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
16821683
catch {unset $v}
@@ -1689,7 +1690,7 @@ proc readrefs {} {
16891690
if {![string match "refs/*" $ref]} continue
16901691
set name [string range $ref 5 end]
16911692
if {[string match "remotes/*" $name]} {
1692-
if {![string match "*/HEAD" $name]} {
1693+
if {![string match "*/HEAD" $name] && !$hideremotes} {
16931694
set headids($name) $id
16941695
lappend idheads($id) $name
16951696
}
@@ -2520,6 +2521,7 @@ proc savestuff {w} {
25202521
global cmitmode wrapcomment datetimeformat limitdiffs
25212522
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
25222523
global autoselect extdifftool perfile_attrs markbgcolor
2524+
global hideremotes
25232525

25242526
if {$stuffsaved} return
25252527
if {![winfo viewable .]} return
@@ -2539,6 +2541,7 @@ proc savestuff {w} {
25392541
puts $f [list set wrapcomment $wrapcomment]
25402542
puts $f [list set autoselect $autoselect]
25412543
puts $f [list set showneartags $showneartags]
2544+
puts $f [list set hideremotes $hideremotes]
25422545
puts $f [list set showlocalchanges $showlocalchanges]
25432546
puts $f [list set datetimeformat $datetimeformat]
25442547
puts $f [list set limitdiffs $limitdiffs]
@@ -7906,6 +7909,11 @@ proc gotocommit {} {
79067909
}
79077910
set id [lindex $matches 0]
79087911
}
7912+
} else {
7913+
if {[catch {set id [exec git rev-parse --verify $sha1string]}]} {
7914+
error_popup [mc "Revision %s is not known" $sha1string]
7915+
return
7916+
}
79097917
}
79107918
}
79117919
if {[commitinview $id $curview]} {
@@ -7915,7 +7923,7 @@ proc gotocommit {} {
79157923
if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {
79167924
set msg [mc "SHA1 id %s is not known" $sha1string]
79177925
} else {
7918-
set msg [mc "Tag/Head %s is not known" $sha1string]
7926+
set msg [mc "Revision %s is not in the current view" $sha1string]
79197927
}
79207928
error_popup $msg
79217929
}
@@ -10383,6 +10391,7 @@ proc doprefs {} {
1038310391
global oldprefs prefstop showneartags showlocalchanges
1038410392
global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
1038510393
global tabstop limitdiffs autoselect extdifftool perfile_attrs
10394+
global hideremotes
1038610395

1038710396
set top .gitkprefs
1038810397
set prefstop $top
@@ -10391,7 +10400,7 @@ proc doprefs {} {
1039110400
return
1039210401
}
1039310402
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10394-
limitdiffs tabstop perfile_attrs} {
10403+
limitdiffs tabstop perfile_attrs hideremotes} {
1039510404
set oldprefs($v) [set $v]
1039610405
}
1039710406
toplevel $top
@@ -10423,6 +10432,9 @@ proc doprefs {} {
1042310432
checkbutton $top.ntag -text [mc "Display nearby tags"] \
1042410433
-font optionfont -variable showneartags
1042510434
grid x $top.ntag -sticky w
10435+
checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10436+
-font optionfont -variable hideremotes
10437+
grid x $top.hideremotes -sticky w
1042610438
checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
1042710439
-font optionfont -variable limitdiffs
1042810440
grid x $top.ldiff -sticky w
@@ -10547,7 +10559,7 @@ proc prefscan {} {
1054710559
global oldprefs prefstop
1054810560

1054910561
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10550-
limitdiffs tabstop perfile_attrs} {
10562+
limitdiffs tabstop perfile_attrs hideremotes} {
1055110563
global $v
1055210564
set $v $oldprefs($v)
1055310565
}
@@ -10561,6 +10573,7 @@ proc prefsok {} {
1056110573
global oldprefs prefstop showneartags showlocalchanges
1056210574
global fontpref mainfont textfont uifont
1056310575
global limitdiffs treediffs perfile_attrs
10576+
global hideremotes
1056410577

1056510578
catch {destroy $prefstop}
1056610579
unset prefstop
@@ -10606,6 +10619,9 @@ proc prefsok {} {
1060610619
$limitdiffs != $oldprefs(limitdiffs)} {
1060710620
reselectline
1060810621
}
10622+
if {$hideremotes != $oldprefs(hideremotes)} {
10623+
rereadrefs
10624+
}
1060910625
}
1061010626

1061110627
proc formatdate {d} {
@@ -10901,7 +10917,7 @@ proc gitattr {path attr default} {
1090110917
} else {
1090210918
set r "unspecified"
1090310919
if {![catch {set line [exec git check-attr $attr -- $path]}]} {
10904-
regexp "(.*): encoding: (.*)" $line m f r
10920+
regexp "(.*): $attr: (.*)" $line m f r
1090510921
}
1090610922
set path_attr_cache($attr,$path) $r
1090710923
}
@@ -10929,7 +10945,7 @@ proc cache_gitattr {attr pathlist} {
1092910945
set newlist [lrange $newlist $lim end]
1093010946
if {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} {
1093110947
foreach row [split $rlist "\n"] {
10932-
if {[regexp "(.*): encoding: (.*)" $row m path value]} {
10948+
if {[regexp "(.*): $attr: (.*)" $row m path value]} {
1093310949
if {[string index $path 0] eq "\""} {
1093410950
set path [encoding convertfrom [lindex $path 0]]
1093510951
}
@@ -11011,6 +11027,7 @@ set mingaplen 100
1101111027
set cmitmode "patch"
1101211028
set wrapcomment "none"
1101311029
set showneartags 1
11030+
set hideremotes 0
1101411031
set maxrefs 20
1101511032
set maxlinelen 200
1101611033
set showlocalchanges 1

0 commit comments

Comments
 (0)