git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: fix in procedure drawcommits

From
Michele Ballabio <barra_cuda@katamail.com>
Date
Sep 3, 2007, 13:59 UTC
Message-ID
<200709031559.49143.barra_cuda@katamail.com>
This patch indroduces a check before unsetting an array element.
Without this, gitk may complain with
	can't unset "prevlines(...)": no such element in array
when scrolling the history view, bugging the user.
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
I don't really know if this is the right fix, but it seems to work.
An example of this error:
can't unset "prevlines(a3b4383d69e0754346578c85ba8ff7c05bd88705)": no such element in array
can't unset "prevlines(a3b4383d69e0754346578c85ba8ff7c05bd88705)": no such element in array
    while executing
"unset prevlines($lid)"
    (procedure "drawcommits" line 39)
    invoked from within
"drawcommits $row $endrow"
    (procedure "drawfrac" line 10)
    invoked from within
"drawfrac $f0 $f1"
    (procedure "scrollcanv" line 3)
    invoked from within
"scrollcanv .tf.histframe.csb 0.00672513 0.0087015"

The first "bad" commit is 9f1afe05c3ab7228e21ba3666c6e35d693149b37 (merged in 1.3.0-rc1):

	gitk: New improved gitk
 gitk |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index 300fdce..527b716 100755
--- a/gitk
+++ b/gitk
@@ -3697,7 +3697,9 @@ proc drawcommits {row {endrow {}}} {
 
 	if {[info exists lineends($r)]} {
 	    foreach lid $lineends($r) {
-		unset prevlines($lid)
+		if {[info exists prevlines($lid)]} {
+		    unset prevlines($lid)
+	        }
 	    }
 	}
 	set rowids [lindex $rowidlist $r]
-- 
1.5.3
Message 1 of 1 in “gitk: fix in procedure drawcommits”
  1. gitk: fix in procedure drawcommitsMichele Ballabio, Sep 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.