git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Oops, get the commit first, then the tree.

From
Shawn Pearce <spearce@spearce.org>
Date
Dec 3, 2006, 02:34 UTC
Message-ID
<20061203023407.GC26668@spearce.org>
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.
...
Show 10 quoted lines
> --- 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...

Previous: Robin Rosenberg
Message 2 of 2 in “Oops, get the commit first, then the tree.”
  1. Oops, get the commit first, then the tree.Robin Rosenberg, Dec 3, 2006
  2. Shawn PearceDec 3, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.