Skip to content

Commit

Permalink
gitk: Fix bug causing the "can't unset idinlist(...)" error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mackerras committed Aug 12, 2007
1 parent 3244729 commit 67a4f1a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gitk
Original file line number Diff line number Diff line change
Expand Up @@ -2880,6 +2880,7 @@ proc layoutrows {row endrow last} {
} elseif {!$idinlist($p)} {
lappend oldolds $p
}
set idinlist($p) 1
}
set nev [expr {[llength $idlist] + [llength $newolds]
+ [llength $oldolds] - $maxwidth + 1}]
Expand Down Expand Up @@ -2952,12 +2953,10 @@ proc layoutrows {row endrow last} {
lset offs $col {}
}
foreach i $newolds {
set idinlist($i) 1
set idrowranges($i) $id
}
incr col $l
foreach oid $oldolds {
set idinlist($oid) 1
set idlist [linsert $idlist $col $oid]
set offs [linsert $offs $col $o]
makeuparrow $oid $col $row $o
Expand Down Expand Up @@ -2998,7 +2997,7 @@ proc layouttail {} {
set col [expr {[llength $idlist] - 1}]
set id [lindex $idlist $col]
addextraid $id $row
unset idinlist($id)
catch {unset idinlist($id)}
lappend idrowranges($id) $id
lappend rowrangelist $idrowranges($id)
unset idrowranges($id)
Expand Down

0 comments on commit 67a4f1a

Please sign in to comment.