aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-06-24 15:45:51 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-06-25 17:46:40 -0700
commit89d4a7377fc578524dd87289afc367287fd9e653 (patch)
treeb1c06be20f533c9b263ded8cc7ee5f3dae6259ee /org.eclipse.jgit.test/tst
parent4c14b7623dd2ff943350eb0f80d899b00450794f (diff)
downloadjgit-89d4a7377fc578524dd87289afc367287fd9e653.tar.gz
jgit-89d4a7377fc578524dd87289afc367287fd9e653.zip
Use FileRepository where we assume other file semantics
When the surrounding code is already heavily based upon the assumption that we have a FileRepository (e.g. because it created that type of repository) keep the type around and use it directly. This permits us to continue to do things like save the configuration file. Change-Id: Ib783f0f6a11acd6aa305c16d61ccc368b46beecc Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java6
5 files changed, 12 insertions, 11 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java
index e3617305f1..070713d7b3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositorySetupWorkDirTest.java
@@ -177,14 +177,14 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
}
private void setBare(File gitDir, boolean bare) throws IOException {
- Repository repo = new FileRepository(gitDir, null);
+ FileRepository repo = new FileRepository(gitDir, null);
repo.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_BARE, bare);
repo.getConfig().save();
}
private void setWorkTree(File gitDir, File workTree) throws IOException {
- Repository repo = new FileRepository(gitDir, null);
+ FileRepository repo = new FileRepository(gitDir, null);
repo.getConfig()
.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_WORKTREE,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
index c5c6d998bb..64df65b4c2 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
@@ -102,7 +102,7 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
}
/** Test repository, initialized for this test case. */
- protected Repository db;
+ protected FileRepository db;
/** Working directory of {@link #db}. */
protected File trash;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java
index b44b9038e9..4e87fd624c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java
@@ -159,7 +159,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
File repo1Parent = new File(trash.getParentFile(), "r1");
File workdir = new File(trash.getParentFile(), "rw");
workdir.mkdir();
- Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
+ FileRepository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
repo1initial.create();
repo1initial.getConfig().setString("core", null, "worktree",
workdir.getAbsolutePath());
@@ -184,7 +184,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
File repo1Parent = new File(trash.getParentFile(), "r1");
File workdir = new File(trash.getParentFile(), "rw");
workdir.mkdir();
- Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
+ FileRepository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
repo1initial.create();
repo1initial.getConfig()
.setString("core", null, "worktree", "../../rw");
@@ -321,7 +321,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
}
public void test007_Open() throws IOException {
- final Repository db2 = new FileRepository(db.getDirectory());
+ final FileRepository db2 = new FileRepository(db.getDirectory());
assertEquals(db.getDirectory(), db2.getDirectory());
assertEquals(db.getObjectsDirectory(), db2.getObjectsDirectory());
assertNotSame(db.getConfig(), db2.getConfig());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java
index 64052323f1..9473fe6318 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java
@@ -47,18 +47,19 @@ import java.util.Date;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.junit.TestRepository;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryTestCase;
/** Support for tests of the {@link RevWalk} class. */
public abstract class RevWalkTestCase extends RepositoryTestCase {
- private TestRepository util;
+ private TestRepository<Repository> util;
protected RevWalk rw;
@Override
public void setUp() throws Exception {
super.setUp();
- util = new TestRepository(db, createRevWalk());
+ util = new TestRepository<Repository>(db, createRevWalk());
rw = util.getRevWalk();
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java
index 40c719f699..b87cc7a99c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java
@@ -292,7 +292,7 @@ public class ReceivePackRefFilterTest extends LocalDiskRepositoryTestCase {
public void testUsingHiddenCommonBlobFails() throws Exception {
// Try to use the 'b' blob that is hidden.
//
- TestRepository s = new TestRepository(src);
+ TestRepository<Repository> s = new TestRepository<Repository>(src);
RevCommit N = s.commit().parent(B).add("q", s.blob("b")).create();
// But don't include it in the pack.
@@ -333,7 +333,7 @@ public class ReceivePackRefFilterTest extends LocalDiskRepositoryTestCase {
public void testUsingUnknownBlobFails() throws Exception {
// Try to use the 'n' blob that is not on the server.
//
- TestRepository s = new TestRepository(src);
+ TestRepository<Repository> s = new TestRepository<Repository>(src);
RevBlob n = s.blob("n");
RevCommit N = s.commit().parent(B).add("q", n).create();
@@ -373,7 +373,7 @@ public class ReceivePackRefFilterTest extends LocalDiskRepositoryTestCase {
}
public void testUsingUnknownTreeFails() throws Exception {
- TestRepository s = new TestRepository(src);
+ TestRepository<Repository> s = new TestRepository<Repository>(src);
RevCommit N = s.commit().parent(B).add("q", s.blob("a")).create();
RevTree t = s.parseBody(N).getTree();