gitk: Fix bug causing the "can't unset idinlist(...)" error
Under some circumstances, having duplicate parents in a commit could trigger a "can't unset idinlist" Tcl error. This fixes the cause (the logic in layoutrows could end up putting the same commit into rowidlist twice) and also puts a catch around the unset to ignore the error. Thanks to Jeff King for coming up with a test script to generate a repo that shows the problem. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Aug 12, 2007 at 17:23 UTC
67a4f1a7f5c778ffa23d1e562feb4cc6d52c9414
1 file changed
+2
-3
gitk
+2
-3
@@ -2880,6 +2880,7 @@ proc layoutrows {row endrow last} {
2880
} elseif {!$idinlist($p)} {
2881
lappend oldolds $p
2882
}
2883
+ set idinlist($p) 1
2884
}
2885
set nev [expr {[llength $idlist] + [llength $newolds]
2886
+ [llength $oldolds] - $maxwidth + 1}]
@@ -2952,12 +2953,10 @@ proc layoutrows {row endrow last} {
2953
lset offs $col {}
2954
}
2955
foreach i $newolds {
2955
- set idinlist($i) 1
2956
set idrowranges($i) $id
2957
}
2958
incr col $l
2959
foreach oid $oldolds {
2960
- set idinlist($oid) 1
2960
set idlist [linsert $idlist $col $oid]
2961
set offs [linsert $offs $col $o]
2962
makeuparrow $oid $col $row $o
@@ -2998,7 +2997,7 @@ proc layouttail {} {
2997
set col [expr {[llength $idlist] - 1}]
2998
set id [lindex $idlist $col]
2999
addextraid $id $row
3001
- unset idinlist($id)
3000
+ catch {unset idinlist($id)}
3001
lappend idrowranges($id) $id
3002
lappend rowrangelist $idrowranges($id)
3003
unset idrowranges($id)