Oops, get the commit first, then the tree.
Quoted 1 line · Robin Rosenberg
This made the eclipse plugin unable to connect to Git.
...
org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java public class Repository { · line 173
Quoted 10 lines
org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java +2
-1@@ -168,7 +168,8 @@ public class Repository { } public Tree mapTree(final String revstr) throws IOException { - final ObjectId id = resolve(revstr); + Commit commit = mapCommit(revstr); + final ObjectId id = commit.getTreeId(); return id != null ? mapTree(id) : null;
I don't want to apply the fix above because mapTree(String) should be able to take an arbitrary SHA1 expression and return the Tree object corresponding to that. Your change only permits commits to be resolved; but if the revstr resolved to a tag we'd need to peel back the tag to get to the tree. Ideally that should be done in mapTree(ObjectId), based on the type of thing ObjectId points to.
I think the bug was caused by a recent breakage in Repository.mapTree (42691339). I fixed it in 020e0ee but neglected to push it out. Actually I'm surprised mapTree(ObjectId) even works before 020e0ee; I just don't see how its right...
PATCH 1/1 Oops, get the commit first, then the tree.
This made the eclipse plugin unable to connect to Git.
--- .../src/org/spearce/jgit/lib/Repository.java | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
(quoted diff) +0 -0
b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java index bfdcd3e..2344817 100644
org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java +2 -1
@@ -168,7 +168,8 @@ public class Repository { } public Tree mapTree(final String revstr) throws IOException { - final ObjectId id = resolve(revstr); + Commit commit = mapCommit(revstr); + final ObjectId id = commit.getTreeId(); return id != null ? mapTree(id) : null; }
Signature · 1 line
1.4.4.gf05d