Skip to content

Commit ffe1529

Browse files
trastpaulusmack
authored andcommitted
gitk: New option to hide remote refs
In repositories with lots of remotes, looking at the history in gitk can be borderline insane with all the red labels for remote refs. Introduce a new option in the preferences that makes gitk ignore remote refs entirely, so they don't take up space in the display. Wished-for-by: Thell Fowler <[email protected]> Signed-off-by: Thomas Rast <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 097e111 commit ffe1529

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

gitk

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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]
@@ -10383,6 +10386,7 @@ proc doprefs {} {
1038310386
global oldprefs prefstop showneartags showlocalchanges
1038410387
global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
1038510388
global tabstop limitdiffs autoselect extdifftool perfile_attrs
10389+
global hideremotes
1038610390

1038710391
set top .gitkprefs
1038810392
set prefstop $top
@@ -10391,7 +10395,7 @@ proc doprefs {} {
1039110395
return
1039210396
}
1039310397
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10394-
limitdiffs tabstop perfile_attrs} {
10398+
limitdiffs tabstop perfile_attrs hideremotes} {
1039510399
set oldprefs($v) [set $v]
1039610400
}
1039710401
toplevel $top
@@ -10423,6 +10427,9 @@ proc doprefs {} {
1042310427
checkbutton $top.ntag -text [mc "Display nearby tags"] \
1042410428
-font optionfont -variable showneartags
1042510429
grid x $top.ntag -sticky w
10430+
checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10431+
-font optionfont -variable hideremotes
10432+
grid x $top.hideremotes -sticky w
1042610433
checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
1042710434
-font optionfont -variable limitdiffs
1042810435
grid x $top.ldiff -sticky w
@@ -10547,7 +10554,7 @@ proc prefscan {} {
1054710554
global oldprefs prefstop
1054810555

1054910556
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10550-
limitdiffs tabstop perfile_attrs} {
10557+
limitdiffs tabstop perfile_attrs hideremotes} {
1055110558
global $v
1055210559
set $v $oldprefs($v)
1055310560
}
@@ -10561,6 +10568,7 @@ proc prefsok {} {
1056110568
global oldprefs prefstop showneartags showlocalchanges
1056210569
global fontpref mainfont textfont uifont
1056310570
global limitdiffs treediffs perfile_attrs
10571+
global hideremotes
1056410572

1056510573
catch {destroy $prefstop}
1056610574
unset prefstop
@@ -10606,6 +10614,9 @@ proc prefsok {} {
1060610614
$limitdiffs != $oldprefs(limitdiffs)} {
1060710615
reselectline
1060810616
}
10617+
if {$hideremotes != $oldprefs(hideremotes)} {
10618+
rereadrefs
10619+
}
1060910620
}
1061010621

1061110622
proc formatdate {d} {
@@ -11011,6 +11022,7 @@ set mingaplen 100
1101111022
set cmitmode "patch"
1101211023
set wrapcomment "none"
1101311024
set showneartags 1
11025+
set hideremotes 0
1101411026
set maxrefs 20
1101511027
set maxlinelen 200
1101611028
set showlocalchanges 1

0 commit comments

Comments
 (0)