Skip to content

Commit ffe115e

Browse files
committed
Merge branch 'oa/hide-more-refs'
* oa/hide-more-refs: gitk: Add user preference to hide specific references Signed-off-by: Johannes Sixt <[email protected]>
2 parents e51b17e + 2441e19 commit ffe115e

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

gitk

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,8 +2033,10 @@ proc readrefs {} {
20332033
set tagids($name) $id
20342034
lappend idtags($id) $name
20352035
} else {
2036-
set otherrefids($name) $id
2037-
lappend idotherrefs($id) $name
2036+
if [is_other_ref_visible $name] {
2037+
set otherrefids($name) $id
2038+
lappend idotherrefs($id) $name
2039+
}
20382040
}
20392041
}
20402042
catch {close $refd}
@@ -11649,6 +11651,13 @@ proc prefspage_general {notebook} {
1164911651
-variable hideremotes
1165011652
grid x $page.hideremotes -sticky w
1165111653
11654+
ttk::entry $page.refstohide -textvariable refstohide
11655+
ttk::frame $page.refstohidef
11656+
ttk::label $page.refstohidef.l -text [mc "Refs to hide (space-separated)" ]
11657+
pack $page.refstohidef.l -side left
11658+
pack configure $page.refstohidef.l -padx 10
11659+
grid x $page.refstohidef $page.refstohide -sticky ew
11660+
1165211661
ttk::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
1165311662
-variable autocopy
1165411663
grid x $page.autocopy -sticky w
@@ -11983,7 +11992,7 @@ proc prefsok {} {
1198311992
$limitdiffs != $oldprefs(limitdiffs)} {
1198411993
reselectline
1198511994
}
11986-
if {$hideremotes != $oldprefs(hideremotes)} {
11995+
if {$hideremotes != $oldprefs(hideremotes) || $refstohide != $oldprefs(refstohide)} {
1198711996
rereadrefs
1198811997
}
1198911998
if {$wrapcomment != $oldprefs(wrapcomment)} {
@@ -12360,6 +12369,23 @@ proc get_path_encoding {path} {
1236012369
return $tcl_enc
1236112370
}
1236212371
12372+
proc is_other_ref_visible {ref} {
12373+
global refstohide
12374+
12375+
if {$refstohide eq {}} {
12376+
return 1
12377+
}
12378+
12379+
foreach pat [split $refstohide " "] {
12380+
if {$pat eq {}} continue
12381+
if {[string match $pat $ref]} {
12382+
return 0
12383+
}
12384+
}
12385+
12386+
return 1
12387+
}
12388+
1236312389
## For msgcat loading, first locate the installation location.
1236412390
if { [info exists ::env(GITK_MSGSDIR)] } {
1236512391
## Msgsdir was manually set in the environment.
@@ -12467,6 +12493,7 @@ set wrapcomment "none"
1246712493
set wrapdefault "none"
1246812494
set showneartags 1
1246912495
set hideremotes 0
12496+
set refstohide ""
1247012497
set sortrefsbytype 1
1247112498
set maxrefs 20
1247212499
set visiblerefs {"master"}
@@ -12610,6 +12637,7 @@ set config_variables {
1261012637
mergecolors
1261112638
perfile_attrs
1261212639
reflinecolor
12640+
refstohide
1261312641
remotebgcolor
1261412642
selectbgcolor
1261512643
showlocalchanges

0 commit comments

Comments
 (0)