aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2009-10-23 06:40:27 (EDT)
committerShawn O. Pearce2009-11-30 20:11:26 (EST)
commit00555bf3cbf3c2072b9e31c034f39340c207fe6d (patch)
tree239bfc15569051f92b067b4c3c2c6beb490f4848
parent0dcbff3a776ea3f8341a7176d3f774032b589616 (diff)
downloadegit-00555bf3cbf3c2072b9e31c034f39340c207fe6d.zip
egit-00555bf3cbf3c2072b9e31c034f39340c207fe6d.tar.gz
egit-00555bf3cbf3c2072b9e31c034f39340c207fe6d.tar.bz2
Assert there are no other git repositories in a parent directoriesrefs/changes/94/94/2
Change-Id: I07c6bda038ae420c2d3be97d0b0fbfa1f5c4a45a Signed-off-by: Mykola Nikishov <mn@mn.com.ua> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index cbe89c3..a82c350 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -10,6 +10,11 @@ package org.eclipse.egit.core.test;
import java.io.File;
import java.io.IOException;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.egit.core.project.RepositoryFinder;
+import org.eclipse.egit.core.project.RepositoryMapping;
import junit.framework.TestCase;
@@ -22,6 +27,7 @@ public abstract class GitTestCase extends TestCase {
protected void setUp() throws Exception {
super.setUp();
project = new TestProject();
+ checkNotNested();
gitDir = new File(project.getProject().getWorkspace().getRoot()
.getRawLocation().toFile(), ".git");
rmrf(gitDir);
@@ -51,4 +57,11 @@ public abstract class GitTestCase extends TestCase {
assert !d.exists();
}
+ protected void checkNotNested() throws CoreException {
+ final Collection<RepositoryMapping> parentRepositories = new RepositoryFinder(
+ project.getProject()).find(null);
+ final int numOfRepositories = parentRepositories.size();
+ assertTrue("parent repository found", numOfRepositories == 0);
+ }
+
}