Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-01-30 22:38:23 +0000
committerMatthias Sohn2012-02-03 01:13:36 +0000
commit30eb9ae4dbe26040b6f2dba516d936ab57be8416 (patch)
tree1196a0f577653bd7e45f1f8705e6ef168ea8d7c0
parentcfac4a6d39f5499451393b8ac7e9517749db4c99 (diff)
downloadegit-30eb9ae4dbe26040b6f2dba516d936ab57be8416.tar.gz
egit-30eb9ae4dbe26040b6f2dba516d936ab57be8416.tar.xz
egit-30eb9ae4dbe26040b6f2dba516d936ab57be8416.zip
Support tracking project at root of repository
Previously a project at the root of the working directory was not tracked since they didn't have a relative path and were not stored correctly in the memento. This case is now explicitly handled and a project at the root of the repository's working directory will now be tracked and re-opened when switching branches. Change-Id: I6ad4620b866fc2bce0ee02e47782bc5a2271aa52 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchProjectTracker.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchProjectTracker.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchProjectTracker.java
index 249d566944..1cbf07a45f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchProjectTracker.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchProjectTracker.java
@@ -68,6 +68,8 @@ class BranchProjectTracker {
private static final String KEY_BRANCH = "branch"; //$NON-NLS-1$
+ private static final String REPO_ROOT = "/"; //$NON-NLS-1$
+
private final Repository repository;
/**
@@ -137,6 +139,8 @@ class BranchProjectTracker {
String fullPath = path.toOSString();
if (fullPath.startsWith(workDir)) {
String relative = fullPath.substring(workDir.length());
+ if (relative.length() == 0)
+ relative = REPO_ROOT;
IMemento child = memento.createChild(KEY_PROJECT);
child.putTextData(relative);
}
@@ -240,7 +244,12 @@ class BranchProjectTracker {
Set<ProjectRecord> records = new LinkedHashSet<ProjectRecord>();
File parent = repository.getWorkTree();
for (String path : paths) {
- File root = new File(parent, path);
+ File root;
+ if (!REPO_ROOT.equals(path))
+ root = new File(parent, path);
+ else
+ root = parent;
+
if (!root.isDirectory())
continue;
File projectDescription = new File(root,

Back to the top