git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Oops, get the commit first, then the tree.
Date: Sat, 2 Dec 2006 21:34:07 -0500	[thread overview]
Message-ID: <20061203023407.GC26668@spearce.org> (raw)
In-Reply-To: <200612030145.45567.robin.rosenberg@dewire.com>

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

-- 

      reply	other threads:[~2006-12-03  2:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-03  0:45 [PATCH] Oops, get the commit first, then the tree Robin Rosenberg
2006-12-03  2:34 ` Shawn Pearce [this message]

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=20061203023407.GC26668@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /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).