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

Re: [EGIT PATCH 2/2] Provide the ability to configure the quickdiff baseline

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 11, 2008, 05:00 UTC
Message-ID
<20080711050035.GE32633@spearce.org>
In-Reply-To
<1215729672-26906-3-git-send-email-robin.rosenberg@dewire.com>
Robin Rosenberg <robin.rosenberg@dewire.com> 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.
Previous: Robin RosenbergNext: Robin Rosenberg
Message 4 of 7 in “Quickdiff improvement”
  1. 0/2 Quickdiff improvementRobin Rosenberg, Jul 10, 2008
  2. 1/2 Make quick diff aware of changes in the repository.Robin Rosenberg, Jul 10, 2008
  3. 2/2 Provide the ability to configure the quickdiff baselineRobin Rosenberg, Jul 10, 2008
  4. Shawn O. PearceJul 11, 2008
  5. Fix nullpointer exceptions in QuickdiffRobin Rosenberg, Jul 11, 2008
  6. EGIT, was Re: [PATCH] Fix nullpointer exceptions in QuickdiffJohannes Schindelin, Jul 11, 2008
  7. Robin RosenbergJul 11, 2008

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.