Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dockerized Testing Toolkit
DTT Backend
Commits
3e8b8bcd
Commit
3e8b8bcd
authored
Jul 01, 2020
by
Kammleiter
Browse files
refactor JGitUtil
parent
2dc4d771
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/hftstuttgart/utils/JGitUtil.java
View file @
3e8b8bcd
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment