summaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-06-16 11:21:57 (GMT)
committerPaul Mackerras <paulus@samba.org>2007-06-23 10:55:26 (GMT)
commit0a4dd8b855fb5e4997087badbb6291cfc3f57baf (patch)
tree6125cf95856819c804f7cda7ecf6e4fdf9482fad /gitk
parente11f12331552427113bcfd3721008ffc7227aac0 (diff)
downloadgit-0a4dd8b855fb5e4997087badbb6291cfc3f57baf.zip
git-0a4dd8b855fb5e4997087badbb6291cfc3f57baf.tar.gz
git-0a4dd8b855fb5e4997087badbb6291cfc3f57baf.tar.bz2
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>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk42
1 files changed, 24 insertions, 18 deletions
diff --git a/gitk b/gitk
index 5948ec3..de5bae7 100755
--- a/gitk
+++ b/gitk
@@ -3831,7 +3831,7 @@ proc viewnextline {dir} {
# add a list of tag or branch names at position pos
# returns the number of names inserted
proc appendrefs {pos ids var} {
- global ctext commitrow linknum curview $var
+ global ctext commitrow linknum curview $var maxrefs
if {[catch {$ctext index $pos}]} {
return 0
@@ -3844,24 +3844,29 @@ proc appendrefs {pos ids var} {
lappend tags [list $tag $id]
}
}
- set tags [lsort -index 0 -decreasing $tags]
- set sep {}
- foreach ti $tags {
- set id [lindex $ti 1]
- set lk link$linknum
- incr linknum
- $ctext tag delete $lk
- $ctext insert $pos $sep
- $ctext insert $pos [lindex $ti 0] $lk
- if {[info exists commitrow($curview,$id)]} {
- $ctext tag conf $lk -foreground blue
- $ctext tag bind $lk <1> \
- [list selectline $commitrow($curview,$id) 1]
- $ctext tag conf $lk -underline 1
- $ctext tag bind $lk <Enter> { %W configure -cursor hand2 }
- $ctext tag bind $lk <Leave> { %W configure -cursor $curtextcursor }
+ if {[llength $tags] > $maxrefs} {
+ $ctext insert $pos "many ([llength $tags])"
+ } else {
+ set tags [lsort -index 0 -decreasing $tags]
+ set sep {}
+ foreach ti $tags {
+ set id [lindex $ti 1]
+ set lk link$linknum
+ incr linknum
+ $ctext tag delete $lk
+ $ctext insert $pos $sep
+ $ctext insert $pos [lindex $ti 0] $lk
+ if {[info exists commitrow($curview,$id)]} {
+ $ctext tag conf $lk -foreground blue
+ $ctext tag bind $lk <1> \
+ [list selectline $commitrow($curview,$id) 1]
+ $ctext tag conf $lk -underline 1
+ $ctext tag bind $lk <Enter> { %W configure -cursor hand2 }
+ $ctext tag bind $lk <Leave> \
+ { %W configure -cursor $curtextcursor }
+ }
+ set sep ", "
}
- set sep ", "
}
$ctext conf -state disabled
return [llength $tags]
@@ -6856,6 +6861,7 @@ set mingaplen 30
set cmitmode "patch"
set wrapcomment "none"
set showneartags 1
+set maxrefs 20
set colors {green red blue magenta darkgrey brown orange}
set bgcolor white