aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Pfeiffer2013-04-12 09:32:26 (EDT)
committerRobin Stocker2013-04-21 11:38:45 (EDT)
commit14952cff7dfb9183e12d981b1882a49c138de17d (patch)
tree1ab5ff2b7740c56085e8255f8eaf353cd6b466b7
parent1ed1e8c52fdb8c49b5b50163521233a8202a8df6 (diff)
downloadegit-14952cff7dfb9183e12d981b1882a49c138de17d.zip
egit-14952cff7dfb9183e12d981b1882a49c138de17d.tar.gz
egit-14952cff7dfb9183e12d981b1882a49c138de17d.tar.bz2
Be more strict when identifying a .git directory as a reporefs/changes/61/11861/4
Don't assume that any .git directory with a file named 'config' in it is a git directory. Change-Id: Id7a2c26c6e3e5ed3dd192c68cc953fe8d89d27b7 Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java
index aa2ecf9..7dc550f 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryFinder.java
@@ -3,6 +3,7 @@
* Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2008, Google Inc.
* Copyright (C) 2012, Fran├žois Rey <eclipse.org_@_francois_._rey_._name>
+ * Copyright (C) 2013, Carsten Pfeiffer <carsten.pfeiffer@gebit.de>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -29,6 +30,8 @@ import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.egit.core.internal.CoreText;
import org.eclipse.egit.core.internal.trace.GitTraceLocation;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;
+import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
/**
@@ -128,8 +131,10 @@ public class RepositoryFinder {
assert fsLoc.isAbsolute();
final File ownCfg = configFor(fsLoc);
final IResource[] children;
+ final FS fs = FS.detect();
- if (ownCfg.isFile()) {
+ if (ownCfg.isFile()
+ && FileKey.isGitRepository(ownCfg.getParentFile(), fs)) {
register(c, ownCfg.getParentFile());
}
if (c instanceof IProject) {
@@ -142,7 +147,9 @@ public class RepositoryFinder {
"Looking at candidate dir: " //$NON-NLS-1$
+ p);
final File pCfg = configFor(p);
- if (pCfg.isFile()) {
+ if (pCfg.isFile()
+ && FileKey.isGitRepository(
+ pCfg.getParentFile(), fs)) {
register(c, pCfg.getParentFile());
}
if (ceilingDirectories.contains(p.getPath()))