Commit 3e8b8bcd authored by Kammleiter's avatar Kammleiter
Browse files

refactor JGitUtil

parent 2dc4d771
......@@ -49,14 +49,7 @@ public class JGitUtil {
}
LOG.info(String.format("Cloning all files from %s into %s", uriToClone, cloneDirectory.getAbsolutePath()));
try {
File temp = new File(cloneDirectory.getPath() + "/src/UnitTests/.git");
if (temp.exists() && temp.isDirectory() && temp.canWrite()) {
FileUtil.deleteFolderRecursively(temp);
}
temp = new File(cloneDirectory.getPath() + "/src/.git");
if (temp.exists() && temp.isDirectory() && temp.canWrite()) {
FileUtil.deleteFolderRecursively(temp);
}
deleteDotGitFolder(cloneDirectory);
UsernamePasswordCredentialsProvider credProvider = null;
LOG.info("using token: " + useToken);
if (useToken) {
......@@ -109,14 +102,7 @@ public class JGitUtil {
}
LOG.info(String.format("Committing all files in: %s and pushing them to: %s", directory.getAbsolutePath(), repository.getCloneUrl()));
try {
File temp = new File(directory.getPath() + "/src/UnitTests/.git");
if (temp.exists() && temp.isDirectory() && temp.canWrite()) {
FileUtil.deleteFolderRecursively(temp);
}
temp = new File(directory.getPath() + "/src/.git");
if (temp.exists() && temp.isDirectory() && temp.canWrite()) {
FileUtil.deleteFolderRecursively(temp);
}
deleteDotGitFolder(directory);
// "git init" new repository
Git.init()
.setDirectory(directory)
......@@ -163,6 +149,10 @@ public class JGitUtil {
if (temp.exists() && temp.isDirectory() && temp.canWrite()) {
FileUtil.deleteFolderRecursively(temp);
}
temp = new File(directory.getPath() + "/.git");
if (temp.exists() && temp.isDirectory() && temp.canWrite()) {
FileUtil.deleteFolderRecursively(temp);
}
}
private void setProxy(boolean proxy) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment