git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Oops, get the commit first, then the tree.
@ 2006-12-03  0:45 Robin Rosenberg
  2006-12-03  2:34 ` Shawn Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Rosenberg @ 2006-12-03  0:45 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: git

This made the eclipse plugin unable to connect to Git.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/jgit/lib/Repository.java       |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java 
b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index bfdcd3e..2344817 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -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;
     }
 
-- 
1.4.4.gf05d


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Oops, get the commit first, then the tree.
  2006-12-03  0:45 [PATCH] Oops, get the commit first, then the tree Robin Rosenberg
@ 2006-12-03  2:34 ` Shawn Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn Pearce @ 2006-12-03  2:34 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> This made the eclipse plugin unable to connect to Git.
...
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
> @@ -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...

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-03  2:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-03  0:45 [PATCH] Oops, get the commit first, then the tree Robin Rosenberg
2006-12-03  2:34 ` Shawn Pearce

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).