]> asedeno.scripts.mit.edu Git - git.git/blobdiff - gitk
Further clean-up: usage() vs die()
[git.git] / gitk
diff --git a/gitk b/gitk
index 91c11a368f71809e290ec669387849aea25dda76..5acaadf495f16d2515ca406fe68b212228b7024f 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -238,6 +238,7 @@ proc updatecommits {} {
     catch {unset selectedline}
     catch {unset thickerline}
     catch {unset viewdata($n)}
+    discardallcommits
     readrefs
     showview $n
 }
@@ -4900,7 +4901,7 @@ proc domktag {} {
 
 proc redrawtags {id} {
     global canv linehtag commitrow idpos selectedline curview
-    global mainfont
+    global mainfont canvxmax
 
     if {![info exists commitrow($curview,$id)]} return
     drawcmitrow $commitrow($curview,$id)
@@ -4988,15 +4989,30 @@ proc wrcomcan {} {
 
 # Stuff for finding nearby tags
 proc getallcommits {} {
-    global allcstart allcommits
+    global allcstart allcommits allcfd
 
     set fd [open [concat | git rev-list --all --topo-order --parents] r]
+    set allcfd $fd
     fconfigure $fd -blocking 0
     set allcommits "reading"
     nowbusy allcommits
     restartgetall $fd
 }
 
+proc discardallcommits {} {
+    global allparents allchildren allcommits allcfd
+    global desc_tags anc_tags alldtags tagisdesc allids desc_heads
+
+    if {![info exists allcommits]} return
+    if {$allcommits eq "reading"} {
+       catch {close $allcfd}
+    }
+    foreach v {allcommits allchildren allparents allids desc_tags anc_tags
+               alldtags tagisdesc desc_heads} {
+       catch {unset $v}
+    }
+}
+
 proc restartgetall {fd} {
     global allcstart
 
@@ -5180,6 +5196,24 @@ proc rereadrefs {} {
     }
 }
 
+proc listrefs {id} {
+    global idtags idheads idotherrefs
+
+    set x {}
+    if {[info exists idtags($id)]} {
+       set x $idtags($id)
+    }
+    set y {}
+    if {[info exists idheads($id)]} {
+       set y $idheads($id)
+    }
+    set z {}
+    if {[info exists idotherrefs($id)]} {
+       set z $idotherrefs($id)
+    }
+    return [list $x $y $z]
+}
+
 proc showtag {tag isnew} {
     global ctext tagcontents tagids linknum