Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-07-04 14:33:24 -0400
committerMichael Keppler2019-07-04 14:33:24 -0400
commitb9df19f1d83ca2daa7272369d264f9806d8118ab (patch)
tree016eedd8b1d5975393d9dc6b0adc8e1a6000a599 /org.eclipse.egit.ui/src/org
parent8ea29e491aa59ee692d982cb517b61e92066dac5 (diff)
downloadegit-b9df19f1d83ca2daa7272369d264f9806d8118ab.tar.gz
egit-b9df19f1d83ca2daa7272369d264f9806d8118ab.tar.xz
egit-b9df19f1d83ca2daa7272369d264f9806d8118ab.zip
Speed up image decoration for remote branch nodes
If a remote tracking branch is checked out, the repository should be in a detached head state, and then we can directly compare the branch name with the objectid of the node. Bug:548978 Change-Id: I73895fc7e243f6d97ab55cc417e78a598580b690 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui/src/org')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryTreeNodeWorkbenchAdapter.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryTreeNodeWorkbenchAdapter.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryTreeNodeWorkbenchAdapter.java
index 479aaec14..598c16381 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryTreeNodeWorkbenchAdapter.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryTreeNodeWorkbenchAdapter.java
@@ -31,8 +31,6 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchAdapter;
@@ -136,15 +134,15 @@ public class RepositoryTreeNodeWorkbenchAdapter extends WorkbenchAdapter {
TagNode tagNode = (TagNode) node;
compareString = tagNode.getCommitId();
} else if (refName.startsWith(Constants.R_REMOTES)) {
- // remote branch: HEAD would be on the commit id to which
- // the branch is pointing
- ObjectId id = repository.resolve(refName);
- if (id == null) {
- return base;
- }
- try (RevWalk rw = new RevWalk(repository)) {
- RevCommit commit = rw.parseCommit(id);
- compareString = commit.getId().name();
+ // remote branch: branch name is object id in detached HEAD
+ // state
+ ObjectId objectId = leaf.getObjectId();
+ if (objectId != null) {
+ String leafName = objectId.getName();
+ if (leafName.equals(branchName)) {
+ return new DecorationOverlayDescriptor(base,
+ UIIcons.OVR_CHECKEDOUT, IDecoration.TOP_LEFT);
+ }
}
} else if (refName.equals(Constants.HEAD)) {
return new DecorationOverlayDescriptor(base,

Back to the top