#12 -- Fix conflicts after merge

merge-requests/8/head
Anton Romanov 3 years ago
parent 387226f26e
commit 7e429fca2c

@ -72,25 +72,6 @@ public class GitRepositoryService {
return branches; return branches;
} }
private String getProjectDirectory(String url) {
return (isBlank(customProjectsDir)
? System.getProperty("java.io.tmpdir")
: customProjectsDir) + url.substring(url.lastIndexOf('/'));
}
private String getProjectGitDirectory(String url) {
return getProjectDirectory(url) + "/.git";
}
public File getProjectDirectoryFile(String url) {
return Path.of(getProjectDirectory(url))
.toFile();
}
private boolean projectDirExists(File file) {
return file.exists();
}
public List<Commit> getCommits(String repositoryUrl, String branchName) throws GitAPIException, IOException { public List<Commit> getCommits(String repositoryUrl, String branchName) throws GitAPIException, IOException {
cloneOrUpdateRepo(repositoryUrl); cloneOrUpdateRepo(repositoryUrl);
Repository localRepo = new FileRepository(getProjectGitDirectory(repositoryUrl)); Repository localRepo = new FileRepository(getProjectGitDirectory(repositoryUrl));
@ -132,6 +113,12 @@ public class GitRepositoryService {
return list; return list;
} }
public File getProjectDirectoryFile(String url) {
validateUrl(url);
return Path.of(getProjectDirectory(url))
.toFile();
}
public void remove(String repositoryUrl) throws IOException { public void remove(String repositoryUrl) throws IOException {
FileUtils.deleteDirectory(getProjectDirectoryFile(repositoryUrl)); FileUtils.deleteDirectory(getProjectDirectoryFile(repositoryUrl));
} }
@ -162,12 +149,6 @@ public class GitRepositoryService {
return getProjectDirectory(url) + "/.git"; return getProjectDirectory(url) + "/.git";
} }
private File getProjectDirectoryFile(String url) {
validateUrl(url);
return Path.of(getProjectDirectory(url))
.toFile();
}
private void validateUrl(String url) { private void validateUrl(String url) {
if (url == null || url.isEmpty()) { if (url == null || url.isEmpty()) {
throw new RuntimeException("Repository url must not empty"); throw new RuntimeException("Repository url must not empty");

Loading…
Cancel
Save