From 3ebba3c724f77d149061c62f4414166649c2e56e Mon Sep 17 00:00:00 2001
From: Paul Mackerras <paulus@samba.org>
Date: Sat, 20 Oct 2007 22:10:52 +1000
Subject: [PATCH] gitk: Avoid an error when cherry-picking if HEAD has moved on
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes an error reported by Adam Piątyszek: if the current HEAD
is not in the graph that gitk knows about when we do a cherry-pick
using gitk, then gitk hits an error when trying to update its
internal representation of the topology.  This avoids the error by
not doing that update if the HEAD before the cherry-pick was a
commit that gitk doesn't know about.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitk b/gitk
index 06172a434b6..f910cba8bfd 100755
--- a/gitk
+++ b/gitk
@@ -6648,7 +6648,7 @@ proc addnewchild {id p} {
     global arcnos arcids arctags arcout arcend arcstart archeads growing
     global seeds allcommits
 
-    if {![info exists allcommits]} return
+    if {![info exists allcommits] || ![info exists arcnos($p)]} return
     lappend allids $id
     set allparents($id) [list $p]
     set allchildren($id) {}