git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michele Ballabio <barra_cuda@katamail.com>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: [PATCH] gitk: avoid error on reload
Date: Sat, 17 May 2008 22:55:52 +0200	[thread overview]
Message-ID: <200805172255.52828.barra_cuda@katamail.com> (raw)

When hitting "Reload", gitk can error out, complaining
about "wrong # coordinates: expected 0 or 4, got 2".
This patch checks that there are 4 coordinates to avoid this
error:

wrong # coordinates: expected 0 or 4, got 2
wrong # coordinates: expected 0 or 4, got 2
    while executing
".tf.histframe.pwclist.canv create rect -outline {} -tags secsel -fill gray85"
    ("eval" body line 1)
    invoked from within
"eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}}  -tags secsel -fill [$canv cget -selectbackground]"
    (procedure "make_secsel" line 6)
    invoked from within
"make_secsel $l"
    (procedure "selectline" line 62)
    invoked from within
"selectline [rowofcommit $pending_select] 1"
    (procedure "layoutmore" line 12)
    invoked from within
"layoutmore"
    (procedure "chewcommits" line 5)
    invoked from within
"chewcommits"
    ("eval" body line 1)
    invoked from within
"eval $script"
    (procedure "dorunq" line 9)
    invoked from within
"dorunq"
    ("after" script)

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---

I don't know if this patch is the right fix, so here is a script
that triggers this error:

--->8---
#!/bin/sh

rm -rf .git
git init
touch initial
git add initial
git commit initial -m "initial"

git checkout -b m-master

sleep 1
touch one
git add one
git commit one -m "one"
sleep 1
touch two
git add two
git commit two -m "two"
sleep 1
touch three
git add three
git commit three -m "three"

sleep 1
echo "Now reorder the commits as:"
echo "pick three"
echo "pick one"
echo "pick two"
read
git rebase -i master

git checkout -b m-reload master

sleep 1
touch four
git add four
git commit four -m "four"
sleep 1
touch five
git add five
git commit five -m "five"

git checkout m-master

gitk --all
# within gitk, reload: it should give an error.
# if it does not error out, checkout another branch and try
# to reload again.
---8<---

 gitk |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gitk b/gitk
index 9ab6dba..041345d 100755
--- a/gitk
+++ b/gitk
@@ -5827,7 +5827,8 @@ proc dispnexttag {} {
 proc make_secsel {l} {
     global linehtag linentag linedtag canv canv2 canv3
 
-    if {![info exists linehtag($l)]} return
+    if {![info exists linehtag($l)] ||
+	[llength [$canv bbox $linehtag($l)]] ne 4 } return
     $canv delete secsel
     set t [eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}} \
 	       -tags secsel -fill [$canv cget -selectbackground]]
-- 
1.5.5.1

             reply	other threads:[~2008-05-17 20:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-17 20:55 Michele Ballabio [this message]
2008-05-18 23:51 ` [PATCH] gitk: avoid error on reload Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200805172255.52828.barra_cuda@katamail.com \
    --to=barra_cuda@katamail.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).