@matheusbsbs / matheus-bagliano / commits / 0a4dd8b855
Fork 0

gitk: Don't try to list large numbers of tags or heads in the details pane

With some large repositories, a commit can end up on thousands of branches, which results in an extremely long "Branches:" line in the details window, and that results in the window being extremely slow to scroll. This fixes it by just showing "many (N)" after "Branches:", "Follows:" or "Precedes:", where N is the number of heads or tags. The limit is currently set at 20 but could be made configurable (and the "many" could be a link to pop up a window listing them all in case anyone really wants to know). Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Jun 16, 2007 at 21:21 UTC 0a4dd8b855fb5e4997087badbb6291cfc3f57baf
1 file changed +24 -18
gitk
+24 -18
@@ -3831,7 +3831,7 @@ proc viewnextline {dir} {
3831 # add a list of tag or branch names at position pos
3832 # returns the number of names inserted
3833 proc appendrefs {pos ids var} {
3834 - global ctext commitrow linknum curview $var
3834 + global ctext commitrow linknum curview $var maxrefs
3835
3836 if {[catch {$ctext index $pos}]} {
3837 return 0
@@ -3844,24 +3844,29 @@ proc appendrefs {pos ids var} {
3844 lappend tags [list $tag $id]
3845 }
3846 }
3847 - set tags [lsort -index 0 -decreasing $tags]
3848 - set sep {}
3849 - foreach ti $tags {
3850 - set id [lindex $ti 1]
3851 - set lk link$linknum
3852 - incr linknum
3853 - $ctext tag delete $lk
3854 - $ctext insert $pos $sep
3855 - $ctext insert $pos [lindex $ti 0] $lk
3856 - if {[info exists commitrow($curview,$id)]} {
3857 - $ctext tag conf $lk -foreground blue
3858 - $ctext tag bind $lk <1> \
3859 - [list selectline $commitrow($curview,$id) 1]
3860 - $ctext tag conf $lk -underline 1
3861 - $ctext tag bind $lk <Enter> { %W configure -cursor hand2 }
3862 - $ctext tag bind $lk <Leave> { %W configure -cursor $curtextcursor }
3847 + if {[llength $tags] > $maxrefs} {
3848 + $ctext insert $pos "many ([llength $tags])"
3849 + } else {
3850 + set tags [lsort -index 0 -decreasing $tags]
3851 + set sep {}
3852 + foreach ti $tags {
3853 + set id [lindex $ti 1]
3854 + set lk link$linknum
3855 + incr linknum
3856 + $ctext tag delete $lk
3857 + $ctext insert $pos $sep
3858 + $ctext insert $pos [lindex $ti 0] $lk
3859 + if {[info exists commitrow($curview,$id)]} {
3860 + $ctext tag conf $lk -foreground blue
3861 + $ctext tag bind $lk <1> \
3862 + [list selectline $commitrow($curview,$id) 1]
3863 + $ctext tag conf $lk -underline 1
3864 + $ctext tag bind $lk <Enter> { %W configure -cursor hand2 }
3865 + $ctext tag bind $lk <Leave> \
3866 + { %W configure -cursor $curtextcursor }
3867 + }
3868 + set sep ", "
3869 }
3864 - set sep ", "
3870 }
3871 $ctext conf -state disabled
3872 return [llength $tags]
@@ -6856,6 +6861,7 @@ set mingaplen 30
6861 set cmitmode "patch"
6862 set wrapcomment "none"
6863 set showneartags 1
6864 +set maxrefs 20
6865
6866 set colors {green red blue magenta darkgrey brown orange}
6867 set bgcolor white