Browse Source

Remove some unnecessary dependencies on FileRepostory

Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
stable-3.0
Robin Rosenberg 12 years ago committed by Chris Aniszczyk
parent
commit
526b6266a5
  1. 6
      org.eclipse.jgit.ant.test/src/org/eclipse/jgit/ant/tasks/GitCloneTaskTest.java
  2. 9
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
  3. 3
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java
  4. 3
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java
  5. 9
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
  6. 15
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
  7. 9
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java
  8. 15
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
  9. 5
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java
  10. 13
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  11. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
  12. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
  13. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java
  14. 22
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
  15. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GCTest.java
  16. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java
  17. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
  18. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java
  19. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java
  20. 6
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java

6
org.eclipse.jgit.ant.test/src/org/eclipse/jgit/ant/tasks/GitCloneTaskTest.java

@ -50,8 +50,8 @@ import java.io.IOException;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.util.FS;
import org.junit.Before;
@ -99,7 +99,7 @@ public class GitCloneTaskTest extends LocalDiskRepositoryTestCase {
@Test
public void shouldCloneAValidGitRepository() throws Exception {
FileRepository repo = createBareRepository();
Repository repo = createBareRepository();
File directory = repo.getDirectory();
task.setUri("file://" + directory);
task.execute();
@ -109,7 +109,7 @@ public class GitCloneTaskTest extends LocalDiskRepositoryTestCase {
@Test
public void shouldCreateABareCloneOfAValidGitRepository() throws Exception {
FileRepository repo = createBareRepository();
Repository repo = createBareRepository();
File directory = repo.getDirectory();
task.setUri("file://" + directory);
task.setBare(true);

9
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java

@ -56,16 +56,15 @@ import org.eclipse.jgit.errors.RemoteRepositoryException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.http.server.resolver.DefaultReceivePackFactory;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.junit.http.HttpTestCase;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport;
@ -77,7 +76,7 @@ import org.junit.Before;
import org.junit.Test;
public class AdvertiseErrorTest extends HttpTestCase {
private FileRepository remoteRepository;
private Repository remoteRepository;
private URIish remoteURI;
@ -85,7 +84,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@ -121,7 +120,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
remoteRepository = src.getRepository();
remoteURI = toURIish(app, srcName);
FileBasedConfig cfg = remoteRepository.getConfig();
StoredConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();
}

3
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java

@ -61,7 +61,6 @@ import java.util.Map;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.junit.http.AccessEvent;
import org.eclipse.jgit.junit.http.HttpTestCase;
@ -92,7 +91,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final File srcGit = src.getRepository().getDirectory();
final URI base = srcGit.getParentFile().toURI();

3
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java

@ -65,7 +65,6 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.junit.http.AccessEvent;
import org.eclipse.jgit.junit.http.HttpTestCase;
@ -98,7 +97,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");

9
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java

@ -60,7 +60,6 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.http.server.resolver.DefaultReceivePackFactory;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.junit.http.AccessEvent;
import org.eclipse.jgit.junit.http.HttpTestCase;
@ -68,9 +67,9 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.transport.PreReceiveHook;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.ReceiveCommand;
@ -85,7 +84,7 @@ import org.junit.Before;
import org.junit.Test;
public class HookMessageTest extends HttpTestCase {
private FileRepository remoteRepository;
private Repository remoteRepository;
private URIish remoteURI;
@ -93,7 +92,7 @@ public class HookMessageTest extends HttpTestCase {
public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@ -134,7 +133,7 @@ public class HookMessageTest extends HttpTestCase {
remoteRepository = src.getRepository();
remoteURI = toURIish(app, srcName);
FileBasedConfig cfg = remoteRepository.getConfig();
StoredConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();
}

15
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java

@ -64,7 +64,6 @@ import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.junit.http.AccessEvent;
import org.eclipse.jgit.junit.http.AppServer;
@ -73,8 +72,8 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.transport.FetchConnection;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;
@ -85,7 +84,7 @@ import org.junit.Before;
import org.junit.Test;
public class HttpClientTests extends HttpTestCase {
private TestRepository<FileRepository> remoteRepository;
private TestRepository<Repository> remoteRepository;
private URIish dumbAuthNoneURI;
@ -134,7 +133,7 @@ public class HttpClientTests extends HttpTestCase {
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
final FileRepository db = remoteRepository.getRepository();
final Repository db = remoteRepository.getRepository();
if (!name.equals(nameOf(db)))
throw new RepositoryNotFoundException(name);
@ -148,7 +147,7 @@ public class HttpClientTests extends HttpTestCase {
return ctx;
}
private static String nameOf(final FileRepository db) {
private static String nameOf(final Repository db) {
return db.getDirectory().getName();
}
@ -217,7 +216,7 @@ public class HttpClientTests extends HttpTestCase {
@Test
public void testListRemote_Dumb_NoHEAD() throws Exception {
FileRepository src = remoteRepository.getRepository();
Repository src = remoteRepository.getRepository();
File headref = new File(src.getDirectory(), Constants.HEAD);
assertTrue("HEAD used to be present", headref.delete());
assertFalse("HEAD is gone", headref.exists());
@ -356,8 +355,8 @@ public class HttpClientTests extends HttpTestCase {
@Test
public void testListRemote_Smart_UploadPackDisabled() throws Exception {
FileRepository src = remoteRepository.getRepository();
final FileBasedConfig cfg = src.getConfig();
Repository src = remoteRepository.getRepository();
final StoredConfig cfg = src.getConfig();
cfg.setBoolean("http", null, "uploadpack", false);
cfg.save();

9
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java

@ -61,14 +61,13 @@ import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.http.server.GitSmartHttpTools;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.junit.http.HttpTestCase;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.transport.PacketLineIn;
import org.eclipse.jgit.transport.PacketLineOut;
import org.eclipse.jgit.transport.URIish;
@ -79,7 +78,7 @@ import org.junit.Before;
import org.junit.Test;
public class ProtocolErrorTest extends HttpTestCase {
private FileRepository remoteRepository;
private Repository remoteRepository;
private URIish remoteURI;
@ -89,7 +88,7 @@ public class ProtocolErrorTest extends HttpTestCase {
public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@ -113,7 +112,7 @@ public class ProtocolErrorTest extends HttpTestCase {
remoteRepository = src.getRepository();
remoteURI = toURIish(app, srcName);
FileBasedConfig cfg = remoteRepository.getConfig();
StoredConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();

15
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java

@ -78,7 +78,6 @@ import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.internal.storage.file.ReflogEntry;
import org.eclipse.jgit.internal.storage.file.ReflogReader;
import org.eclipse.jgit.junit.TestRepository;
@ -90,9 +89,9 @@ import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.transport.FetchConnection;
import org.eclipse.jgit.transport.HttpTransport;
import org.eclipse.jgit.transport.RemoteRefUpdate;
@ -107,7 +106,7 @@ import org.junit.Test;
public class SmartClientSmartServerTest extends HttpTestCase {
private static final String HDR_TRANSFER_ENCODING = "Transfer-Encoding";
private FileRepository remoteRepository;
private Repository remoteRepository;
private URIish remoteURI;
@ -121,7 +120,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
public void setUp() throws Exception {
super.setUp();
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@ -601,16 +600,16 @@ public class SmartClientSmartServerTest extends HttpTestCase {
@Test
public void testPush_ChunkedEncoding() throws Exception {
final TestRepository<FileRepository> src = createTestRepository();
final TestRepository<Repository> src = createTestRepository();
final RevBlob Q_bin = src.blob(new TestRng("Q").nextBytes(128 * 1024));
final RevCommit Q = src.commit().add("Q", Q_bin).create();
final FileRepository db = src.getRepository();
final Repository db = src.getRepository();
final String dstName = Constants.R_HEADS + "new.branch";
Transport t;
enableReceivePack();
final FileBasedConfig cfg = db.getConfig();
final StoredConfig cfg = db.getConfig();
cfg.setInt("core", null, "compression", 0);
cfg.setInt("http", null, "postbuffer", 8 * 1024);
cfg.save();
@ -660,7 +659,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
}
private void enableReceivePack() throws IOException {
final FileBasedConfig cfg = remoteRepository.getConfig();
final StoredConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();
}

5
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java

@ -55,7 +55,6 @@ import java.util.List;
import java.util.Set;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.AnyObjectId;
@ -85,9 +84,9 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase {
super.tearDown();
}
protected TestRepository<FileRepository> createTestRepository()
protected TestRepository<Repository> createTestRepository()
throws IOException {
return new TestRepository<FileRepository>(createBareRepository());
return new TestRepository<Repository>(createBareRepository());
}
protected URIish toURIish(String path) throws URISyntaxException {

13
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java

@ -52,14 +52,15 @@ import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheCheckout;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
@ -83,7 +84,7 @@ class Clone extends AbstractFetchCommand {
@Argument(index = 1, metaVar = "metaVar_directory")
private String localName;
private FileRepository dst;
private Repository dst;
@Override
protected final boolean requiresRepository() {
@ -106,9 +107,9 @@ class Clone extends AbstractFetchCommand {
if (gitdir == null)
gitdir = new File(localName, Constants.DOT_GIT).getAbsolutePath();
dst = new FileRepository(gitdir);
dst = new FileRepositoryBuilder().setGitDir(new File(gitdir)).build();
dst.create();
final FileBasedConfig dstcfg = dst.getConfig();
final StoredConfig dstcfg = dst.getConfig();
dstcfg.setBoolean("core", null, "bare", false); //$NON-NLS-1$ //$NON-NLS-2$
dstcfg.save();
db = dst;
@ -134,7 +135,7 @@ class Clone extends AbstractFetchCommand {
private void saveRemote(final URIish uri) throws URISyntaxException,
IOException {
final FileBasedConfig dstcfg = dst.getConfig();
final StoredConfig dstcfg = dst.getConfig();
final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName);
rc.addURI(uri);
rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java

@ -56,7 +56,6 @@ import java.io.IOException;
import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@ -74,7 +73,7 @@ import org.junit.Test;
public class PullCommandTest extends RepositoryTestCase {
/** Second Test repository */
protected FileRepository dbTarget;
protected Repository dbTarget;
private Git source;

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java

@ -57,7 +57,6 @@ import java.io.IOException;
import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.RebaseResult.Status;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
@ -76,7 +75,7 @@ import org.junit.Test;
public class PullCommandWithRebaseTest extends RepositoryTestCase {
/** Second Test repository */
protected FileRepository dbTarget;
protected Repository dbTarget;
private Git source;

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java

@ -68,6 +68,7 @@ import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.transport.PackedObjectInfo;
import org.eclipse.jgit.util.FileUtils;
@ -81,14 +82,14 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase {
private ObjectReader reader;
private TestRepository<FileRepository> test;
private TestRepository<Repository> test;
@Before
public void setUp() throws Exception {
super.setUp();
db = createBareRepository();
reader = db.newObjectReader();
test = new TestRepository<FileRepository>(db);
test = new TestRepository<Repository>(db);
}
@After

22
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java

@ -56,7 +56,7 @@ import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.util.FileUtils;
import org.junit.Test;
@ -64,7 +64,7 @@ import org.junit.Test;
public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@Test
public void testShouldAutomagicallyDetectGitDirectory() throws Exception {
FileRepository r = createWorkRepository();
Repository r = createWorkRepository();
File d = new File(r.getDirectory(), "sub-dir");
FileUtils.mkdir(d);
@ -74,8 +74,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@Test
public void emptyRepositoryFormatVersion() throws Exception {
FileRepository r = createWorkRepository();
FileBasedConfig config = r.getConfig();
Repository r = createWorkRepository();
StoredConfig config = r.getConfig();
config.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "");
config.save();
@ -85,8 +85,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@Test
public void invalidRepositoryFormatVersion() throws Exception {
FileRepository r = createWorkRepository();
FileBasedConfig config = r.getConfig();
Repository r = createWorkRepository();
StoredConfig config = r.getConfig();
config.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "notanumber");
config.save();
@ -101,8 +101,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@Test
public void unknownRepositoryFormatVersion() throws Exception {
FileRepository r = createWorkRepository();
FileBasedConfig config = r.getConfig();
Repository r = createWorkRepository();
StoredConfig config = r.getConfig();
config.setLong(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1);
config.save();
@ -118,7 +118,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@SuppressWarnings("resource" /* java 7 */)
@Test
public void absoluteGitDirRef() throws Exception {
FileRepository repo1 = createWorkRepository();
Repository repo1 = createWorkRepository();
File dir = createTempDirectory("dir");
File dotGit = new File(dir, Constants.DOT_GIT);
new FileWriter(dotGit).append(
@ -136,7 +136,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@SuppressWarnings("resource" /* java 7 */)
@Test
public void relativeGitDirRef() throws Exception {
FileRepository repo1 = createWorkRepository();
Repository repo1 = createWorkRepository();
File dir = new File(repo1.getWorkTree(), "dir");
assertTrue(dir.mkdir());
File dotGit = new File(dir, Constants.DOT_GIT);
@ -155,7 +155,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
@SuppressWarnings("resource" /* java 7 */)
@Test
public void scanWithGitDirRef() throws Exception {
FileRepository repo1 = createWorkRepository();
Repository repo1 = createWorkRepository();
File dir = createTempDirectory("dir");
File dotGit = new File(dir, Constants.DOT_GIT);
new FileWriter(dotGit).append(

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GCTest.java

@ -64,13 +64,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.internal.storage.file.GC;
import org.eclipse.jgit.internal.storage.file.LockFile;
import org.eclipse.jgit.internal.storage.file.PackFile;
import org.eclipse.jgit.internal.storage.file.PackIndex;
import org.eclipse.jgit.internal.storage.file.RefDirectory;
import org.eclipse.jgit.internal.storage.file.RefDirectoryUpdate;
import org.eclipse.jgit.internal.storage.file.GC.RepoStatistics;
import org.eclipse.jgit.internal.storage.file.PackIndex.MutableEntry;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java

@ -71,6 +71,7 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.ObjectStream;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.storage.file.WindowCacheConfig;
import org.eclipse.jgit.transport.PackParser;
@ -86,9 +87,9 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
private TestRng rng;
private FileRepository repo;
private Repository repo;
private TestRepository<FileRepository> tr;
private TestRepository<Repository> tr;
private WindowCursor wc;
@ -107,7 +108,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
WindowCache.reconfigure(cfg);
repo = createBareRepository();
tr = new TestRepository<FileRepository>(repo);
tr = new TestRepository<Repository>(repo);
wc = (WindowCursor) repo.newObjectReader();
}

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java

@ -61,7 +61,6 @@ import org.eclipse.jgit.dircache.DirCacheEditor;
import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.Config;
@ -81,12 +80,12 @@ import org.junit.Test;
* Unit tests of {@link SubmoduleWalk}
*/
public class SubmoduleWalkTest extends RepositoryTestCase {
private TestRepository<FileRepository> testDb;
private TestRepository<Repository> testDb;
@Before
public void setUp() throws Exception {
super.setUp();
testDb = new TestRepository<FileRepository>(db);
testDb = new TestRepository<Repository>(db);
}
@Test

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java

@ -55,10 +55,10 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.SampleDataRepositoryTestCase;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -216,7 +216,7 @@ public class TransportTest extends SampleDataRepositoryTestCase {
@Test
public void testLocalTransportWithRelativePath() throws Exception {
FileRepository other = createWorkRepository();
Repository other = createWorkRepository();
String otherDir = other.getWorkTree().getName();
RemoteConfig config = new RemoteConfig(db.getConfig(), "other");

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java

@ -50,21 +50,21 @@ import java.io.IOException;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheEditor;
import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.junit.Before;
import org.junit.Test;
public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase {
private FileRepository db;
private Repository db;
@Before
public void setUp() throws Exception {

6
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java

@ -62,8 +62,8 @@ import org.eclipse.jgit.errors.NoRemoteRepositoryException;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryBuilder;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.util.io.MessageWriter;
import org.eclipse.jgit.util.io.SafeBufferedOutputStream;
@ -201,7 +201,7 @@ class TransportLocal extends Transport implements PackTransport {
final Repository dst;
try {
dst = new FileRepository(remoteGitDir);
dst = new RepositoryBuilder().setGitDir(remoteGitDir).build();
} catch (IOException err) {
throw new TransportException(uri, JGitText.get().notAGitDirectory);
}
@ -341,7 +341,7 @@ class TransportLocal extends Transport implements PackTransport {
final Repository dst;
try {
dst = new FileRepository(remoteGitDir);
dst = new RepositoryBuilder().setGitDir(remoteGitDir).build();
} catch (IOException err) {
throw new TransportException(uri, JGitText.get().notAGitDirectory);
}

Loading…
Cancel
Save