From: Shawn O. Pearce Date: Fri, 11 Jul 2008 05:00:35 GMT Subject: Re: [EGIT PATCH 2/2] Provide the ability to configure the quickdiff baseline Message-ID: <20080711050035.GE32633@spearce.org> In-Reply-To: <1215729672-26906-3-git-send-email-robin.rosenberg@dewire.com> Robin Rosenberg wrote: > + TreeEntry blobEnry = repository.mapTree(baseline).findBlobMember(gitPath); > + if (blobEnry != null) { > + Activator.trace("(GitQuickDiffProvider) compareTo: " + baseline); > + ObjectLoader loader = repository.openBlob(blobEnry.getId()); For what it is worth, it is probably faster to use TreeWalk: final TreeWalk tw = TreeWalk.forPath( repository, gitPath, new ObjectId[]{ repository.resolve(baseline + "^{tree}") }); if (tw != null) { Activator.trace("(GitQuickDiffProvider) compareTo: " + baseline); ObjectLoader loader = repository.openBlob(tw.getObjectId(0)); I probably should teach TreeWalk how to do the ^{tree} on its own so it can just take a tree-ish here, but you still had to invoke resolve to go from String to ObjectId so its not major problem. The reason TreeWalk is faster is we spend less time parsing the entries, and we avoid entries which are after the path we need to walk down. E.g. if the subtree we need to enter into is in the middle of the parent tree TreeWalk won't even touch the remainder of the parent tree records. Tree/TreeEntry still does. -- Shawn.