From d4ed7fccc0497b906f05c9fe40e1d3d0c30a8cfd Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 10 Feb 2010 07:06:17 -0800 Subject: [PATCH] Fix IncorrectObjectTypeException on initial commit On the initial commit of a project, "a" is the empty tree, not a commit object, in order to show all initial files as new files. To cast it into a RevTree we must use parseTree() and not parseCommit().getTree(). For all subsequent changes, "a" will be a commit and parseTree() will automatically deference to the commit's root tree. Bug: issue 442 Change-Id: I9302b6e3d6e9117159e32e96119b6563ac8e26c1 Signed-off-by: Shawn O. Pearce --- .../java/com/google/gerrit/server/patch/PatchListCacheImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java index 71e2ad0dfb..fa75f42716 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListCacheImpl.java @@ -174,7 +174,7 @@ public class PatchListCacheImpl implements PatchListCache { } } - RevTree aTree = a != null ? rw.parseCommit(a).getTree() : null; + RevTree aTree = a != null ? rw.parseTree(a) : null; RevTree bTree = b.getTree(); final int cnt = p.getFiles().size();