Skip to content

Commit bde4a0f

Browse files
max630paulusmack
authored andcommitted
gitk: Add visiblerefs option, which lists always-shown branches
When many branches contain a commit, the branches used to be shown in the form "A, B and many more", where A, B can be master of current HEAD. But there are more which might be interesting to always know about. For example, "origin/master". The new option, visiblerefs, is stored in ~/.gitk. It contains a list of references which are always shown before "and many more" if they contain the commit. By default it is `{"master"}', which is compatible with previous behavior. Signed-off-by: Max Kirillov <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent ac54a4b commit bde4a0f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

gitk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,7 @@ proc savestuff {w} {
27872787
global mainheadcirclecolor workingfilescirclecolor indexcirclecolor
27882788
global linkfgcolor circleoutlinecolor
27892789
global autoselect autosellen extdifftool perfile_attrs markbgcolor use_ttk
2790-
global hideremotes want_ttk maxrefs
2790+
global hideremotes want_ttk maxrefs visiblerefs
27912791
global config_file config_file_tmp
27922792

27932793
if {$stuffsaved} return
@@ -2813,6 +2813,7 @@ proc savestuff {w} {
28132813
puts $f [list set autosellen $autosellen]
28142814
puts $f [list set showneartags $showneartags]
28152815
puts $f [list set maxrefs $maxrefs]
2816+
puts $f [list set visiblerefs $visiblerefs]
28162817
puts $f [list set hideremotes $hideremotes]
28172818
puts $f [list set showlocalchanges $showlocalchanges]
28182819
puts $f [list set datetimeformat $datetimeformat]
@@ -7035,7 +7036,7 @@ proc viewnextline {dir} {
70357036
# add a list of tag or branch names at position pos
70367037
# returns the number of names inserted
70377038
proc appendrefs {pos ids var} {
7038-
global ctext linknum curview $var maxrefs mainheadid
7039+
global ctext linknum curview $var maxrefs visiblerefs mainheadid
70397040

70407041
if {[catch {$ctext index $pos}]} {
70417042
return 0
@@ -7056,14 +7057,14 @@ proc appendrefs {pos ids var} {
70567057
if {[llength $tags] > $maxrefs} {
70577058
# If we are displaying heads, and there are too many,
70587059
# see if there are some important heads to display.
7059-
# Currently this means "master" and the current head.
7060+
# Currently that are the current head and heads listed in $visiblerefs option
70607061
set itags {}
70617062
if {$var eq "idheads"} {
70627063
set utags {}
70637064
foreach ti $tags {
70647065
set hname [lindex $ti 0]
70657066
set id [lindex $ti 1]
7066-
if {($hname eq "master" || $id eq $mainheadid) &&
7067+
if {([lsearch -exact $visiblerefs $hname] != -1 || $id eq $mainheadid) &&
70677068
[llength $itags] < $maxrefs} {
70687069
lappend itags $ti
70697070
} else {
@@ -12045,6 +12046,7 @@ set wrapcomment "none"
1204512046
set showneartags 1
1204612047
set hideremotes 0
1204712048
set maxrefs 20
12049+
set visiblerefs {"master"}
1204812050
set maxlinelen 200
1204912051
set showlocalchanges 1
1205012052
set limitdiffs 1

0 commit comments

Comments
 (0)