aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2013-06-27 11:37:05 (EDT)
committerJohn Arthorne2013-07-04 13:49:17 (EDT)
commitcf70a754998ce44212ab18bec09948058595eca2 (patch)
treed1b69f9ef5b0307f7498c1642480cc39c8e889ef
parent28510e674e66d4d04a9914ad9616e30667a0c3bc (diff)
downloadorg.eclipse.orion.server-cf70a754998ce44212ab18bec09948058595eca2.zip
org.eclipse.orion.server-cf70a754998ce44212ab18bec09948058595eca2.tar.gz
org.eclipse.orion.server-cf70a754998ce44212ab18bec09948058595eca2.tar.bz2
Bug 411836 - Update to JGit 3.0v20130704-1749
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/GitFileDecorator.java5
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/FetchJob.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListBranchesJob.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListTagsJob.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PullJob.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PushJob.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/RemoteDetailsJob.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/Clone.java16
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/ConfigOption.java3
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/AbstractGitHandler.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitCloneHandlerV1.java6
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitConfigHandlerV1.java12
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitIndexHandlerV1.java4
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitRemoteHandlerV1.java10
-rw-r--r--bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitStatusHandlerV1.java4
-rw-r--r--releng/org.eclipse.orion.target/org.eclipse.orion.target.target4
-rw-r--r--tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitCheckoutTest.java4
-rw-r--r--tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitConfigTest.java6
-rw-r--r--tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitFetchTest.java4
-rw-r--r--tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitPushTest.java8
-rw-r--r--tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitRemoteTest.java4
-rw-r--r--tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitTest.java12
22 files changed, 64 insertions, 66 deletions
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/GitFileDecorator.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/GitFileDecorator.java
index 7836fe1..f51b6cd 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/GitFileDecorator.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/GitFileDecorator.java
@@ -21,7 +21,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.core.IWebResourceDecorator;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
@@ -186,7 +185,7 @@ public class GitFileDecorator implements IWebResourceDecorator {
if (gitDir == null)
return null;
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
return db;
}
@@ -211,7 +210,7 @@ public class GitFileDecorator implements IWebResourceDecorator {
File gitDir = GitUtils.getGitDir(localFile);
if (gitDir == null) {
gitDir = new File(localFile, Constants.DOT_GIT);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = FileRepositoryBuilder.create(gitDir);
repo.create();
//we need to perform an initial commit to workaround JGit bug 339610.
Git git = new Git(repo);
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/FetchJob.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/FetchJob.java
index de65831..36f7cae 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/FetchJob.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/FetchJob.java
@@ -19,7 +19,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.*;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.lib.RefUpdate.Result;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.*;
import org.eclipse.orion.server.git.GitActivator;
import org.eclipse.orion.server.git.GitCredentialsProvider;
@@ -113,7 +113,7 @@ public class FetchJob extends GitJob {
p = path.removeFirstSegments(1);
else
p = path.removeFirstSegments(2);
- return new FileRepository(GitUtils.getGitDir(p));
+ return FileRepositoryBuilder.create(GitUtils.getGitDir(p));
}
@Override
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListBranchesJob.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListBranchesJob.java
index 1d7b8b2..6be51c7 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListBranchesJob.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListBranchesJob.java
@@ -23,7 +23,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.server.core.ServerStatus;
import org.eclipse.orion.server.git.GitActivator;
@@ -103,7 +103,7 @@ public class ListBranchesJob extends GitJob {
protected IStatus performJob() {
try {
File gitDir = GitUtils.getGitDir(path);
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
Git git = new Git(db);
List<Ref> branchRefs = git.branchList().call();
List<Branch> branches = new ArrayList<Branch>(branchRefs.size());
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListTagsJob.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListTagsJob.java
index 925f1cd..bff6efb 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListTagsJob.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/ListTagsJob.java
@@ -23,7 +23,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.server.core.ServerStatus;
import org.eclipse.orion.server.git.GitActivator;
@@ -104,7 +104,7 @@ public class ListTagsJob extends GitJob {
try {
// list all tags
File gitDir = GitUtils.getGitDir(path);
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
Git git = new Git(db);
List<Ref> refs = git.tagList().call();
JSONObject result = new JSONObject();
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PullJob.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PullJob.java
index 1691c71..8be1d3d 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PullJob.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PullJob.java
@@ -19,7 +19,7 @@ import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.*;
import org.eclipse.orion.server.git.GitActivator;
import org.eclipse.orion.server.git.GitCredentialsProvider;
@@ -46,7 +46,7 @@ public class PullJob extends GitJob {
}
private IStatus doPull() throws IOException, GitAPIException, CoreException {
- Repository db = new FileRepository(GitUtils.getGitDir(path));
+ Repository db = FileRepositoryBuilder.create(GitUtils.getGitDir(path));
Git git = new Git(db);
PullCommand pc = git.pull();
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PushJob.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PushJob.java
index 7874038..cbcf669 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PushJob.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/PushJob.java
@@ -22,7 +22,7 @@ import org.eclipse.jgit.api.PushCommand;
import org.eclipse.jgit.api.errors.*;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.*;
import org.eclipse.orion.server.git.GitActivator;
import org.eclipse.orion.server.git.GitCredentialsProvider;
@@ -56,7 +56,7 @@ public class PushJob extends GitJob {
private IStatus doPush() throws IOException, CoreException, URISyntaxException, GitAPIException {
// /git/remote/{remote}/{branch}/file/{path}
File gitDir = GitUtils.getGitDir(path.removeFirstSegments(2));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
Git git = new Git(db);
PushCommand pushCommand = git.push();
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/RemoteDetailsJob.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/RemoteDetailsJob.java
index 3829dd9..2a76a4c 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/RemoteDetailsJob.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/jobs/RemoteDetailsJob.java
@@ -23,7 +23,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.server.core.ServerStatus;
import org.eclipse.orion.server.git.GitActivator;
@@ -101,7 +101,7 @@ public class RemoteDetailsJob extends GitJob {
try {
File gitDir = GitUtils.getGitDir(path);
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
Git git = new Git(db);
Set<String> configNames = db.getConfig().getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
for (String configN : configNames) {
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/Clone.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/Clone.java
index 79d783d..146b181 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/Clone.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/Clone.java
@@ -17,10 +17,8 @@ import java.net.URISyntaxException;
import java.util.Map.Entry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jgit.lib.ConfigConstants;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.lib.*;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.orion.internal.server.servlets.Activator;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
@@ -45,7 +43,7 @@ public class Clone {
private URI contentLocation;
private URIish uriish;
private String name;
- private FileRepository db;
+ private Repository db;
private URI baseLocation;
private static final ResourceShape DEFAULT_RESOURCE_SHAPE = new ResourceShape();
@@ -127,9 +125,9 @@ public class Clone {
return this.name;
}
- private FileRepository getRepository() throws IOException {
+ private Repository getRepository() throws IOException {
if (db == null)
- db = new FileRepository(new File(new File(getContentLocation()), Constants.DOT_GIT));
+ db = FileRepositoryBuilder.create(new File(new File(getContentLocation()), Constants.DOT_GIT));
return db;
}
@@ -226,7 +224,7 @@ public class Clone {
@PropertyDescription(name = GitConstants.KEY_URL)
private String getCloneUrl() {
try {
- FileBasedConfig config = getRepository().getConfig();
+ StoredConfig config = getRepository().getConfig();
String remoteUri = config.getString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL);
if (remoteUri != null)
return remoteUri;
@@ -243,7 +241,7 @@ public class Clone {
public JSONObject toJSON(Entry<IPath, File> entry, URI aBaseLocation) throws IOException, URISyntaxException {
id = Activator.LOCATION_FILE_SERVLET + '/' + entry.getKey().toString();
name = entry.getKey().lastSegment();
- db = new FileRepository(entry.getValue());
+ db = FileRepositoryBuilder.create(entry.getValue());
this.baseLocation = aBaseLocation;
return toJSON();
}
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/ConfigOption.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/ConfigOption.java
index ed9aac4..31fca03 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/ConfigOption.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/objects/ConfigOption.java
@@ -16,9 +16,9 @@ import java.net.URISyntaxException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jgit.errors.ConfigInvalidException;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.util.FS;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.server.core.resources.Property;
@@ -123,6 +123,7 @@ public class ConfigOption extends GitObject {
* Retrieves local config without any base config.
*/
private FileBasedConfig getLocalConfig() throws IOException {
+ // TODO: remove usage of internal type
if (db instanceof FileRepository) {
FileRepository fr = (FileRepository) db;
FileBasedConfig config = new FileBasedConfig(fr.getConfig().getFile(), FS.detect());
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/AbstractGitHandler.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/AbstractGitHandler.java
index a499891..605d575 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/AbstractGitHandler.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/AbstractGitHandler.java
@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.core.runtime.*;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.servlets.ServletResourceHandler;
import org.eclipse.orion.server.core.LogHelper;
import org.eclipse.orion.server.core.ServerStatus;
@@ -98,7 +98,7 @@ public abstract class AbstractGitHandler extends ServletResourceHandler<String>
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
String relativePath = GitUtils.getRelativePath(filePath, firstGitDir.getKey());
- db = new FileRepository(gitDir);
+ db = FileRepositoryBuilder.create(gitDir);
RequestInfo requestInfo = new RequestInfo(request, response, db, gitSegment, relativePath, filePath);
switch (getMethod(request)) {
case GET :
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitCloneHandlerV1.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitCloneHandlerV1.java
index 7a29cd5..51e3f45 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitCloneHandlerV1.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitCloneHandlerV1.java
@@ -24,7 +24,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.*;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.lib.*;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
@@ -316,7 +316,7 @@ public class GitCloneHandlerV1 extends ServletResourceHandler<String> {
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
- Git git = new Git(new FileRepository(gitDir));
+ Git git = new Git(FileRepositoryBuilder.create(gitDir));
if (paths != null) {
Set<String> toRemove = new HashSet<String>();
CheckoutCommand checkout = git.checkout();
@@ -396,7 +396,7 @@ public class GitCloneHandlerV1 extends ServletResourceHandler<String> {
ProjectInfo webProject = GitUtils.projectFromPath(path);
if (webProject != null && isAccessAllowed(request.getRemoteUser(), webProject)) {
File gitDir = GitUtils.getGitDirs(path, Traverse.CURRENT).values().iterator().next();
- Repository repo = new FileRepository(gitDir);
+ Repository repo = FileRepositoryBuilder.create(gitDir);
repo.close();
FileUtils.delete(repo.getWorkTree(), FileUtils.RECURSIVE | FileUtils.RETRY);
if (path.segmentCount() == 3)
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitConfigHandlerV1.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitConfigHandlerV1.java
index 08a946a..042a55b 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitConfigHandlerV1.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitConfigHandlerV1.java
@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.core.runtime.*;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.internal.server.servlets.ServletResourceHandler;
import org.eclipse.orion.server.core.ServerStatus;
@@ -72,7 +72,7 @@ public class GitConfigHandlerV1 extends ServletResourceHandler<String> {
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(1));
if (gitDir == null)
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, NLS.bind("No repository found under {0}", p.removeFirstSegments(1)), null));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
URI cloneLocation = BaseToCloneConverter.getCloneLocation(baseLocation, BaseToCloneConverter.CONFIG);
ConfigOption configOption = new ConfigOption(cloneLocation, db);
OrionServlet.writeJSONResponse(request, response, configOption.toJSON(/* all */));
@@ -82,7 +82,7 @@ public class GitConfigHandlerV1 extends ServletResourceHandler<String> {
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(2));
if (gitDir == null)
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, NLS.bind("No repository found under {0}", p.removeFirstSegments(2)), null));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
URI cloneLocation = BaseToCloneConverter.getCloneLocation(baseLocation, BaseToCloneConverter.CONFIG_OPTION);
try {
ConfigOption configOption = new ConfigOption(cloneLocation, db, p.segment(0));
@@ -104,7 +104,7 @@ public class GitConfigHandlerV1 extends ServletResourceHandler<String> {
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(1));
if (gitDir == null)
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, NLS.bind("No repository found under {0}", p.removeFirstSegments(1)), null));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.CONFIG);
JSONObject toPost = OrionServlet.readJSONRequest(request);
String key = toPost.optString(GitConstants.KEY_CONFIG_ENTRY_KEY, null);
@@ -139,7 +139,7 @@ public class GitConfigHandlerV1 extends ServletResourceHandler<String> {
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(2));
if (gitDir == null)
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, NLS.bind("No repository found under {0}", p.removeFirstSegments(2)), null));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.CONFIG_OPTION);
try {
ConfigOption configOption = new ConfigOption(cloneLocation, db, p.segment(0));
@@ -175,7 +175,7 @@ public class GitConfigHandlerV1 extends ServletResourceHandler<String> {
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(2));
if (gitDir == null)
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, NLS.bind("No repository found under {0}", p.removeFirstSegments(2)), null));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.CONFIG_OPTION);
try {
ConfigOption configOption = new ConfigOption(cloneLocation, db, GitUtils.decode(p.segment(0)));
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitIndexHandlerV1.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitIndexHandlerV1.java
index 96040c8..db6790f 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitIndexHandlerV1.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitIndexHandlerV1.java
@@ -23,7 +23,7 @@ import org.eclipse.jgit.api.ResetCommand.ResetType;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.NoFilepatternException;
import org.eclipse.jgit.lib.*;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.core.IOUtilities;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.internal.server.servlets.ServletResourceHandler;
@@ -62,7 +62,7 @@ public class GitIndexHandlerV1 extends ServletResourceHandler<String> {
File gitDir = set.iterator().next().getValue();
if (gitDir == null)
return false; // TODO: or an error response code, 405?
- db = new FileRepository(gitDir);
+ db = FileRepositoryBuilder.create(gitDir);
switch (getMethod(request)) {
case GET :
return handleGet(request, response, db, GitUtils.getRelativePath(p, set.iterator().next().getKey()));
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitRemoteHandlerV1.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitRemoteHandlerV1.java
index 0ff723d..6ce3b5c 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitRemoteHandlerV1.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitRemoteHandlerV1.java
@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.core.runtime.*;
import org.eclipse.jgit.lib.*;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.*;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.internal.server.servlets.ServletResourceHandler;
@@ -67,7 +67,7 @@ public class GitRemoteHandlerV1 extends ServletResourceHandler<String> {
if (p.segment(0).equals("file")) { //$NON-NLS-1$
// /git/remote/file/{path}
File gitDir = GitUtils.getGitDir(p);
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
Set<String> configNames = db.getConfig().getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
JSONObject result = new JSONObject();
JSONArray children = new JSONArray();
@@ -97,7 +97,7 @@ public class GitRemoteHandlerV1 extends ServletResourceHandler<String> {
} else if (p.segment(2).equals("file")) { //$NON-NLS-1$
// /git/remote/{remote}/{branch}/file/{path}
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(2));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.REMOTE_BRANCH);
Remote remote = new Remote(cloneLocation, db, p.segment(0));
RemoteBranch remoteBranch = new RemoteBranch(cloneLocation, db, remote, GitUtils.decode(p.segment(1)));
@@ -121,7 +121,7 @@ public class GitRemoteHandlerV1 extends ServletResourceHandler<String> {
String remoteName = p.segment(0);
File gitDir = GitUtils.getGitDir(p.removeFirstSegments(1));
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
StoredConfig config = db.getConfig();
config.unsetSection(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName);
config.save();
@@ -190,7 +190,7 @@ public class GitRemoteHandlerV1 extends ServletResourceHandler<String> {
String pushRefSpec = toPut.optString(GitConstants.KEY_REMOTE_PUSH_REF, null);
File gitDir = GitUtils.getGitDir(p);
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
StoredConfig config = db.getConfig();
RemoteConfig rc = new RemoteConfig(config, remoteName);
diff --git a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitStatusHandlerV1.java b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitStatusHandlerV1.java
index 015f74a..57ae3b0 100644
--- a/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitStatusHandlerV1.java
+++ b/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitStatusHandlerV1.java
@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.core.runtime.*;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.servlets.ServletResourceHandler;
import org.eclipse.orion.server.core.ServerStatus;
import org.eclipse.orion.server.git.objects.Status;
@@ -51,7 +51,7 @@ public class GitStatusHandlerV1 extends ServletResourceHandler<String> {
File gitDir = set.iterator().next().getValue();
if (gitDir == null)
return false; // TODO: or an error response code, 405?
- Repository db = new FileRepository(gitDir);
+ Repository db = FileRepositoryBuilder.create(gitDir);
Git git = new Git(db);
org.eclipse.jgit.api.Status gitStatus = git.status().call();
diff --git a/releng/org.eclipse.orion.target/org.eclipse.orion.target.target b/releng/org.eclipse.orion.target/org.eclipse.orion.target.target
index 9518d52..4355874 100644
--- a/releng/org.eclipse.orion.target/org.eclipse.orion.target.target
+++ b/releng/org.eclipse.orion.target/org.eclipse.orion.target.target
@@ -2,8 +2,8 @@
<?pde version="3.8"?><target name="org.eclipse.orion" sequenceNumber="5">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.jgit" version="2.1.0.201209190230-r"/>
-<repository location="http://download.eclipse.org/egit/updates-2.1"/>
+<unit id="org.eclipse.jgit" version="3.0.0.201306101825-r"/>
+<repository location="http://download.eclipse.org/egit/updates-3.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.compare.core" version="0.0.0"/>
diff --git a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitCheckoutTest.java b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitCheckoutTest.java
index 0c0ffe1..e30229c 100644
--- a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitCheckoutTest.java
+++ b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitCheckoutTest.java
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.core.IOUtilities;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.server.core.ServerStatus;
@@ -541,7 +541,7 @@ public class GitCheckoutTest extends GitTest {
IPath randomLocation = AllGitTests.getRandomLocation();
randomLocation = randomLocation.addTrailingSeparator().append(Constants.DOT_GIT);
File dotGitDir = randomLocation.toFile().getCanonicalFile();
- Repository db2 = new FileRepository(dotGitDir);
+ Repository db2 = FileRepositoryBuilder.create(dotGitDir);
assertFalse(dotGitDir.exists());
db2.create(false /* non bare */);
diff --git a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitConfigTest.java b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitConfigTest.java
index 8f0059e..6c09b23 100644
--- a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitConfigTest.java
+++ b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitConfigTest.java
@@ -22,7 +22,7 @@ import java.net.URI;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.orion.internal.server.core.IOUtilities;
import org.eclipse.orion.internal.server.servlets.ProtocolConstants;
import org.eclipse.orion.server.git.GitConstants;
@@ -550,7 +550,7 @@ public class GitConfigTest extends GitTest {
@Test
public void testKeyToSegmentsMethod() throws Exception {
- Object configOption = ReflectionUtils.callConstructor(ConfigOption.class, new Object[] {new URI(""), new FileRepository(new File(""))});
+ Object configOption = ReflectionUtils.callConstructor(ConfigOption.class, new Object[] {new URI(""), FileRepositoryBuilder.create(new File(""))});
String[] segments = (String[]) ReflectionUtils.callMethod(configOption, "keyToSegments", new Object[] {"a.b.c"});
assertArrayEquals(new String[] {"a", "b", "c"}, segments);
@@ -567,7 +567,7 @@ public class GitConfigTest extends GitTest {
@Test
public void testSegmentsToKeyMethod() throws Exception {
- Object configOption = ReflectionUtils.callConstructor(ConfigOption.class, new Object[] {new URI(""), new FileRepository(new File(""))});
+ Object configOption = ReflectionUtils.callConstructor(ConfigOption.class, new Object[] {new URI(""), FileRepositoryBuilder.create(new File(""))});
String key = (String) ReflectionUtils.callMethod(configOption, "segmentsToKey", new Object[] {new String[] {"a", "b", "c"}});
assertEquals("a.b.c", key);
diff --git a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitFetchTest.java b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitFetchTest.java
index bf3693c..322dc7d 100644
--- a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitFetchTest.java
+++ b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitFetchTest.java
@@ -25,8 +25,8 @@ import org.eclipse.jgit.api.Git;
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.RevCommit;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.orion.internal.server.core.IOUtilities;
@@ -516,7 +516,7 @@ public class GitFetchTest extends GitTest {
@Test
public void testForcedFetch() throws Exception {
// overwrite system settings, allow forced pushes, see bug 371881
- FileBasedConfig cfg = db.getConfig();
+ StoredConfig cfg = db.getConfig();
cfg.setBoolean("receive", null, "denyNonFastforwards", false);
cfg.save();
diff --git a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitPushTest.java b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitPushTest.java
index d93dfde..9dc65fc 100644
--- a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitPushTest.java
+++ b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitPushTest.java
@@ -26,8 +26,8 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.lib.StoredConfig;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FileUtils;
@@ -663,7 +663,7 @@ public class GitPushTest extends GitTest {
@Test
public void testForcedPush() throws Exception {
// overwrite system settings, allow forced pushes, see bug 371881
- FileBasedConfig cfg = db.getConfig();
+ StoredConfig cfg = db.getConfig();
cfg.setBoolean("receive", null, "denyNonFastforwards", false);
cfg.save();
@@ -829,7 +829,7 @@ public class GitPushTest extends GitTest {
IPath randomLocation = AllGitTests.getRandomLocation();
randomLocation = randomLocation.addTrailingSeparator().append(Constants.DOT_GIT);
File dotGitDir = randomLocation.toFile().getCanonicalFile();
- Repository db2 = new FileRepository(dotGitDir);
+ Repository db2 = FileRepositoryBuilder.create(gitDir);
assertFalse(dotGitDir.exists());
db2.create(false /* non bare */);
diff --git a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitRemoteTest.java b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitRemoteTest.java
index 396d40e..9d4b65b 100644
--- a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitRemoteTest.java
+++ b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitRemoteTest.java
@@ -28,7 +28,7 @@ import org.eclipse.jgit.api.ListBranchCommand.ListMode;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
@@ -335,7 +335,7 @@ public class GitRemoteTest extends GitTest {
final String pushRefSpec = "refs/heads/*:refs/heads/*";
addRemote(remotesLocation, remoteName, remoteUri, fetchRefSpec, pushUri, pushRefSpec);
- Repository db2 = new FileRepository(GitUtils.getGitDir(new Path(toRelativeURI(clonePath.toString()))));
+ Repository db2 = FileRepositoryBuilder.create(GitUtils.getGitDir(new Path(toRelativeURI(clonePath.toString()))));
StoredConfig config = db2.getConfig();
RemoteConfig rc = new RemoteConfig(config, remoteName);
diff --git a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitTest.java b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitTest.java
index de539bf..f2a36cc 100644
--- a/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitTest.java
+++ b/tests/org.eclipse.orion.server.tests/src/org/eclipse/orion/server/tests/servlets/git/GitTest.java
@@ -52,8 +52,8 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.lib.StoredConfig;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
@@ -103,7 +103,7 @@ public abstract class GitTest extends FileSystemTest {
File gitDir;
File testFile;
- protected FileRepository db;
+ protected Repository db;
@BeforeClass
public static void setupWorkspace() {
@@ -223,7 +223,7 @@ public abstract class GitTest extends FileSystemTest {
gitDir = randomLocation.toFile();
randomLocation = randomLocation.addTrailingSeparator().append(Constants.DOT_GIT);
File dotGitDir = randomLocation.toFile().getCanonicalFile();
- db = new FileRepository(dotGitDir);
+ db = FileRepositoryBuilder.create(dotGitDir);
assertFalse(dotGitDir.exists());
db.create(false /* non bare */);
@@ -242,7 +242,7 @@ public abstract class GitTest extends FileSystemTest {
// The system settings on eclipse.org was changed to receive.denyNonFastForward=true, see bug 343150.
// Imitate the same setup when running tests locally, see bug 371881.
- FileBasedConfig cfg = db.getConfig();
+ StoredConfig cfg = db.getConfig();
cfg.setBoolean("receive", null, "denyNonFastforwards", true);
cfg.save();
}
@@ -345,7 +345,7 @@ public abstract class GitTest extends FileSystemTest {
} else {
fail(fileLocation + " is not a repository");
}
- return new FileRepository(file);
+ return FileRepositoryBuilder.create(file);
}
// see org.eclipse.orion.internal.server.servlets.workspace.WorkspaceResourceHandler.generateProjectLocation(WebProject, String)