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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux