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

Minor gitk bug - update on empty project : can't read "viewmainheadid_orig(1)": no such variable

From
IFIndigo Frankencastle <swediomurital@gmail.com>
Date
Jan 23, 2013, 14:00 UTC
Message-ID
<CAHioFH-Nf=J0pkyx+684o3bv-DKOitb_-co9zG+A_WYh8mT9LA@mail.gmail.com>
One of these "weird usage causes weird bugs".
One way to reproduce:

mkdir foo cd foo git init git commit -am "Initial" gitk & # or gitk --all & <F5>

Resulting in (gitk-git/gitk line 503 - 512):
can't read "viewmainheadid_orig(1)": no such variable
can't read "viewmainheadid_orig(1)": no such variable
    while executing
"if {$mainheadid ne $viewmainheadid_orig($view)} {
	if {$showlocalchanges} {
	    dohidelocalchanges
	}
	set viewmainheadid($view) $mainheadid
	set vie..."
    (procedure "updatecommits" line 13)
    invoked from within
"updatecommits"
    (command bound to event)

As "$mainheadid" is not set, should there be something in the direction of this perhaps?

    ...
Subject: [PATCH] gitk catch missing head id on update
---
 gitk-git/gitk |    5 +++++
 1 file changed, 5 insertions(+)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index d93bd99..fa869d7 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -499,6 +499,11 @@ proc updatecommits {} {

     set hasworktree [hasworktree]
     rereadrefs
+    if {$mainheadid eq ""} {
+	# error_popup "[mc "Error updating commits:"] No main HEAD id"
+	show_status [mc "No main HEAD id"]
+	return {}
+    }
     set view $curview
     if {$mainheadid ne $viewmainheadid_orig($view)} {
 	if {$showlocalchanges} {
-- 
1.7.10.4

    ...
Or perhaps some logic in:
proc rereadrefs {}

----
Best regards,
IF
Message 1 of 1 in “Minor gitk bug - update on empty project : can't read "viewmainheadid_orig(1)": no such variable”
  1. Indigo FrankencastleJan 23, 2013

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.