summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.junit/src')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
index 45c6c41f2c..4b512ed09e 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
@@ -293,11 +293,8 @@ public abstract class LocalDiskRepositoryTestCase {
* the repository could not be created in the temporary area
*/
private FileRepository createRepository(boolean bare) throws IOException {
- String uniqueId = System.currentTimeMillis() + "_" + (testCount++);
- String gitdirName = "test" + uniqueId + (bare ? "" : "/") + Constants.DOT_GIT;
- File gitdir = new File(trash, gitdirName).getCanonicalFile();
+ File gitdir = createUniqueTestGitDir(bare);
FileRepository db = new FileRepository(gitdir);
-
assertFalse(gitdir.exists());
db.create();
toClose.add(db);
@@ -305,6 +302,23 @@ public abstract class LocalDiskRepositoryTestCase {
}
/**
+ * Creates a new unique directory for a test repository
+ *
+ * @param bare
+ * true for a bare repository; false for a repository with a
+ * working directory
+ * @return a unique directory for a test repository
+ * @throws IOException
+ */
+ protected File createUniqueTestGitDir(boolean bare) throws IOException {
+ String uniqueId = System.currentTimeMillis() + "_" + (testCount++);
+ String gitdirName = "test" + uniqueId + (bare ? "" : "/")
+ + Constants.DOT_GIT;
+ File gitdir = new File(trash, gitdirName).getCanonicalFile();
+ return gitdir;
+ }
+
+ /**
* Run a hook script in the repository, returning the exit status.
*
* @param db