Commits

Anonymous committed 67a4f1a

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>

Comments (0)

Files changed (1)

 	    } elseif {!$idinlist($p)} {
 		lappend oldolds $p
 	    }
+	    set idinlist($p) 1
 	}
 	set nev [expr {[llength $idlist] + [llength $newolds]
 		       + [llength $oldolds] - $maxwidth + 1}]
 	    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
 	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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.