diff options
author | Paul Mackerras <paulus@samba.org> | 2007-10-21 12:58:42 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-21 12:58:42 +1000 |
commit | e5ef6f952a13342065d44bab53999e8d8529cc3b (patch) | |
tree | ff949dc563c30998da2f48fbd3e915b52ea20087 | |
parent | 3ebba3c724f77d149061c62f4414166649c2e56e (diff) | |
download | git-e5ef6f952a13342065d44bab53999e8d8529cc3b.tar.gz git-e5ef6f952a13342065d44bab53999e8d8529cc3b.tar.xz |
gitk: Fix "can't unset prevlines(...)" Tcl error
This fixes the error reported by Michele Ballabio, where gitk will
throw a Tcl error "can't unset prevlines(...)" when displaying a
commit that has a parent commit listed more than once, and the commit
is the first child of that parent.
The problem was basically that we had two variables, prevlines and
lineends, and were relying on the invariant that prevlines($id) was
set iff $id was in the lineends($r) list for some $r. But having
a duplicate parent breaks that invariant since we end up with the
parent listed twice in lineends.
This fixes it by simplifying the logic to use only a single variable,
lineend. It also rearranges things a little so that we don't try to
draw the line for the duplicated parent twice.
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-x | gitk | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -3695,34 +3695,23 @@ proc drawcommits {row {endrow {}}} { drawcmitrow $r if {$r == $er} break set nextid [lindex $displayorder [expr {$r + 1}]] - if {$wasdrawn && [info exists iddrawn($nextid)]} { - catch {unset prevlines} - continue - } + if {$wasdrawn && [info exists iddrawn($nextid)]} continue drawparentlinks $id $r - if {[info exists lineends($r)]} { - foreach lid $lineends($r) { - unset prevlines($lid) - } - } set rowids [lindex $rowidlist $r] foreach lid $rowids { if {$lid eq {}} continue + if {[info exists lineend($lid)] && $lineend($lid) > $r} continue if {$lid eq $id} { # see if this is the first child of any of its parents foreach p [lindex $parentlist $r] { if {[lsearch -exact $rowids $p] < 0} { # make this line extend up to the child - set le [drawlineseg $p $r $er 0] - lappend lineends($le) $p - set prevlines($p) 1 + set lineend($p) [drawlineseg $p $r $er 0] } } - } elseif {![info exists prevlines($lid)]} { - set le [drawlineseg $lid $r $er 1] - lappend lineends($le) $lid - set prevlines($lid) 1 + } else { + set lineend($lid) [drawlineseg $lid $r $er 1] } } } |