{"thread":{"id":"32703","subject":"Minor gitk bug - update on empty project : can't read \"viewmainheadid_orig(1)\": no such variable","startedAt":"2013-01-23T14:00:02Z","lastAt":"2013-01-23T14:00:02Z","messageCount":1,"participants":["Indigo Frankencastle"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"207593","messageId":"CAHioFH-Nf=J0pkyx+684o3bv-DKOitb_-co9zG+A_WYh8mT9LA@mail.gmail.com","threadId":"32703","inReplyTo":null,"subject":"Minor gitk bug - update on empty project : can't read \"viewmainheadid_orig(1)\": no such variable","fromName":"Indigo Frankencastle","fromEmail":"swediomurital@gmail.com","sentAt":"2013-01-23T14:00:02Z","receivedAt":"2013-01-23T14:00:02Z","isPatch":false,"sender":{"key":"swediomurital@gmail.com","avatar":null},"body":"One of these \"weird usage causes weird bugs\".\n\nOne way to reproduce:\n\nmkdir foo\ncd foo\ngit init\ngit commit -am \"Initial\"\ngitk &\n# or\ngitk --all &\n<F5>\n\nResulting in (gitk-git/gitk line 503 - 512):\n\ncan't read \"viewmainheadid_orig(1)\": no such variable\ncan't read \"viewmainheadid_orig(1)\": no such variable\n    while executing\n\"if {$mainheadid ne $viewmainheadid_orig($view)} {\n\tif {$showlocalchanges} {\n\t    dohidelocalchanges\n\t}\n\tset viewmainheadid($view) $mainheadid\n\tset vie...\"\n    (procedure \"updatecommits\" line 13)\n    invoked from within\n\"updatecommits\"\n    (command bound to event)\n\nAs \"$mainheadid\" is not set, should there be something in the\ndirection of this perhaps?\n\n    ...\nSubject: [PATCH] gitk catch missing head id on update\n\n---\n gitk-git/gitk |    5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex d93bd99..fa869d7 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -499,6 +499,11 @@ proc updatecommits {} {\n\n     set hasworktree [hasworktree]\n     rereadrefs\n+    if {$mainheadid eq \"\"} {\n+\t# error_popup \"[mc \"Error updating commits:\"] No main HEAD id\"\n+\tshow_status [mc \"No main HEAD id\"]\n+\treturn {}\n+    }\n     set view $curview\n     if {$mainheadid ne $viewmainheadid_orig($view)} {\n \tif {$showlocalchanges} {\n-- \n1.7.10.4\n\n    ...\nOr perhaps some logic in:\nproc rereadrefs {}\n\n----\nBest regards,\nIF\n"}]}