From 7e429fca2c0763ad666b65883a1dfb168733f23b Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 10 Apr 2021 09:49:32 +0400 Subject: [PATCH] #12 -- Fix conflicts after merge --- .../service/GitRepositoryService.java | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java b/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java index a20915b..3f50e52 100644 --- a/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java +++ b/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java @@ -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 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");