mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 14:05:44 +01:00
Remove unnecessary interface
This commit is contained in:
@@ -13,31 +13,27 @@ import java.io.File;
|
||||
public class SimpleGitWorkdirFactory extends SimpleWorkdirFactory<Repository, GitContext> implements GitWorkdirFactory {
|
||||
|
||||
public SimpleGitWorkdirFactory() {
|
||||
super(new GitCloneProvider());
|
||||
}
|
||||
|
||||
public SimpleGitWorkdirFactory(File poolDirectory) {
|
||||
super(poolDirectory, new GitCloneProvider());
|
||||
SimpleGitWorkdirFactory(File poolDirectory) {
|
||||
super(poolDirectory);
|
||||
}
|
||||
|
||||
private static class GitCloneProvider implements CloneProvider<Repository, GitContext> {
|
||||
|
||||
@Override
|
||||
public ParentAndClone<Repository> cloneRepository(GitContext context, File target) {
|
||||
try {
|
||||
return new ParentAndClone<>(null, Git.cloneRepository()
|
||||
.setURI(createScmTransportProtocolUri(context.getDirectory()))
|
||||
.setDirectory(target)
|
||||
.call()
|
||||
.getRepository());
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not clone working copy of repository", e);
|
||||
}
|
||||
@Override
|
||||
public ParentAndClone<Repository> cloneRepository(GitContext context, File target) {
|
||||
try {
|
||||
return new ParentAndClone<>(null, Git.cloneRepository()
|
||||
.setURI(createScmTransportProtocolUri(context.getDirectory()))
|
||||
.setDirectory(target)
|
||||
.call()
|
||||
.getRepository());
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not clone working copy of repository", e);
|
||||
}
|
||||
}
|
||||
|
||||
private String createScmTransportProtocolUri(File bareRepository) {
|
||||
return ScmTransportProtocol.NAME + "://" + bareRepository.getAbsolutePath();
|
||||
}
|
||||
private String createScmTransportProtocolUri(File bareRepository) {
|
||||
return ScmTransportProtocol.NAME + "://" + bareRepository.getAbsolutePath();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +42,7 @@ public class SimpleGitWorkdirFactory extends SimpleWorkdirFactory<Repository, Gi
|
||||
}
|
||||
|
||||
@Override
|
||||
protected sonia.scm.repository.Repository getRepository(GitContext context) {
|
||||
protected sonia.scm.repository.Repository getScmRepository(GitContext context) {
|
||||
return context.getRepository();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user