#12 -- Fix conflicts after merge

This commit is contained in:
Anton Romanov 2021-04-10 09:49:32 +04:00
parent 387226f26e
commit 7e429fca2c

View File

@ -72,25 +72,6 @@ public class GitRepositoryService {
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 {
cloneOrUpdateRepo(repositoryUrl);
Repository localRepo = new FileRepository(getProjectGitDirectory(repositoryUrl));
@ -132,6 +113,12 @@ public class GitRepositoryService {
return list;
}
public File getProjectDirectoryFile(String url) {
validateUrl(url);
return Path.of(getProjectDirectory(url))
.toFile();
}
public void remove(String repositoryUrl) throws IOException {
FileUtils.deleteDirectory(getProjectDirectoryFile(repositoryUrl));
}
@ -162,12 +149,6 @@ public class GitRepositoryService {
return getProjectDirectory(url) + "/.git";
}
private File getProjectDirectoryFile(String url) {
validateUrl(url);
return Path.of(getProjectDirectory(url))
.toFile();
}
private void validateUrl(String url) {
if (url == null || url.isEmpty()) {
throw new RuntimeException("Repository url must not empty");