Slightly older version of master from https://github.com/j6t/gitk
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

gitk: Display important heads even when there are many

When there are more than $maxrefs descendant heads to display in the
Branches field of the commit display, we currently just display "many",
which is not very informative. To make the display more informative,
we now look for "master" and whichever head is currently checked out,
and display them even if there are too many heads to display them all.
The display then looks like "Branches: master and many more (33)" for
instance.

Signed-off-by: Paul Mackerras <paulus@samba.org>

+44 -15
+44 -15
gitk
··· 6879 6879 # add a list of tag or branch names at position pos 6880 6880 # returns the number of names inserted 6881 6881 proc appendrefs {pos ids var} { 6882 - global ctext linknum curview $var maxrefs 6882 + global ctext linknum curview $var maxrefs mainheadid 6883 6883 6884 6884 if {[catch {$ctext index $pos}]} { 6885 6885 return 0 ··· 6892 6892 lappend tags [list $tag $id] 6893 6893 } 6894 6894 } 6895 + 6896 + set sep {} 6897 + set tags [lsort -index 0 -decreasing $tags] 6898 + set nutags 0 6899 + 6895 6900 if {[llength $tags] > $maxrefs} { 6896 - $ctext insert $pos "[mc "many"] ([llength $tags])" 6897 - } else { 6898 - set tags [lsort -index 0 -decreasing $tags] 6899 - set sep {} 6900 - foreach ti $tags { 6901 - set id [lindex $ti 1] 6902 - set lk link$linknum 6903 - incr linknum 6904 - $ctext tag delete $lk 6905 - $ctext insert $pos $sep 6906 - $ctext insert $pos [lindex $ti 0] $lk 6907 - setlink $id $lk 6908 - set sep ", " 6901 + # If we are displaying heads, and there are too many, 6902 + # see if there are some important heads to display. 6903 + # Currently this means "master" and the current head. 6904 + set itags {} 6905 + if {$var eq "idheads"} { 6906 + set utags {} 6907 + foreach ti $tags { 6908 + set hname [lindex $ti 0] 6909 + set id [lindex $ti 1] 6910 + if {($hname eq "master" || $id eq $mainheadid) && 6911 + [llength $itags] < $maxrefs} { 6912 + lappend itags $ti 6913 + } else { 6914 + lappend utags $ti 6915 + } 6916 + } 6917 + set tags $utags 6918 + } 6919 + if {$itags ne {}} { 6920 + set str [mc "and many more"] 6921 + set sep " " 6922 + } else { 6923 + set str [mc "many"] 6909 6924 } 6925 + $ctext insert $pos "$str ([llength $tags])" 6926 + set nutags [llength $tags] 6927 + set tags $itags 6928 + } 6929 + 6930 + foreach ti $tags { 6931 + set id [lindex $ti 1] 6932 + set lk link$linknum 6933 + incr linknum 6934 + $ctext tag delete $lk 6935 + $ctext insert $pos $sep 6936 + $ctext insert $pos [lindex $ti 0] $lk 6937 + setlink $id $lk 6938 + set sep ", " 6910 6939 } 6911 6940 $ctext tag add wwrap "$pos linestart" "$pos lineend" 6912 6941 $ctext conf -state disabled 6913 - return [llength $tags] 6942 + return [expr {[llength $tags] + $nutags}] 6914 6943 } 6915 6944 6916 6945 # called when we have finished computing the nearby tags