From: "Shawn O. Pearce" <spearce@spearce•org>
To: Robin Rosenberg <robin.rosenberg@dewire•com>
Cc: git@vger•kernel.org, Marek Zawirski <marek.zawirski@gmail•com>
Subject: Re: [EGIT PATCH 2/2] Provide the ability to configure the quickdiff baseline
Date: Fri, 11 Jul 2008 05:00:35 +0000 [thread overview]
Message-ID: <20080711050035.GE32633@spearce.org> (raw)
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.
next prev parent reply other threads:[~2008-07-11 5:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-10 22:41 [EGIT PATCH 0/2] Quickdiff improvement Robin Rosenberg
2008-07-10 22:41 ` [EGIT PATCH 1/2] Make quick diff aware of changes in the repository Robin Rosenberg
2008-07-10 22:41 ` [EGIT PATCH 2/2] Provide the ability to configure the quickdiff baseline Robin Rosenberg
2008-07-11 5:00 ` Shawn O. Pearce [this message]
2008-07-11 21:34 ` [PATCH] Fix nullpointer exceptions in Quickdiff Robin Rosenberg
2008-07-11 21:50 ` EGIT, was " Johannes Schindelin
2008-07-11 22:15 ` Robin Rosenberg
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=20080711050035.GE32633@spearce.org \
--to=spearce@spearce$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=marek.zawirski@gmail$(echo .)com \
--cc=robin.rosenberg@dewire$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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