Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GitWrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Seibt
GitWrapper
Commits
cba7ba06
Commit
cba7ba06
authored
6 years ago
by
Florian Heck
Browse files
Options
Downloads
Patches
Plain Diff
Make clone actually fallback to import instead of just importing.
parent
69a7a56b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
Make clone actually fallback to import instead of just importing.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/uni_passau/fim/gitwrapper/GitWrapper.java
+17
-14
17 additions, 14 deletions
src/de/uni_passau/fim/gitwrapper/GitWrapper.java
with
17 additions
and
14 deletions
src/de/uni_passau/fim/gitwrapper/GitWrapper.java
+
17
−
14
View file @
cba7ba06
package
de.uni_passau.fim.gitwrapper
;
import
de.uni_passau.fim.processexecutor.ProcessExecutor
;
import
de.uni_passau.fim.processexecutor.ToolNotWorkingException
;
import
de.uni_passau.fim.processexecutor.ToolWrapper
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.StringReader
;
...
...
@@ -7,24 +11,13 @@ import java.io.StringWriter;
import
java.nio.file.InvalidPathException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Scanner
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
de.uni_passau.fim.processexecutor.ProcessExecutor
;
import
de.uni_passau.fim.processexecutor.ToolNotWorkingException
;
import
de.uni_passau.fim.processexecutor.ToolWrapper
;
import
static
java
.
util
.
Collections
.
singletonList
;
/**
...
...
@@ -91,7 +84,7 @@ public class GitWrapper extends ToolWrapper {
/**
* Attempts to clone the git repository at the given <code>url</code> into a directory under <code>parentDir</code>.
* If <code>parentDir</code> already contains a git repository with the name that would be produced when cloning
* <code>url</code> it is assumed to be a clone of <code>url</code> and
return
ed as a {@link Repository}.
* <code>url</code> it is assumed to be a clone of <code>url</code> and
{@link #importRepository(File) import
ed
}
as a {@link Repository}.
*
* @param parentDir
* the directory in which to place the clone of <code>url</code>
...
...
@@ -143,7 +136,17 @@ public class GitWrapper extends ToolWrapper {
}
LOG
.
fine
(()
->
String
.
format
(
"'%s' is a git repository. Assuming it is a clone of '%s'."
,
repoPath
,
url
));
Repository
repo
=
new
Repository
(
this
,
url
,
repoDir
);
Optional
<
Repository
>
maybeRepo
=
importRepository
(
repoDir
);
if
(!
maybeRepo
.
isPresent
())
{
LOG
.
warning
(
"Could not import repo from "
+
repoDir
);
return
null
;
}
Repository
repo
=
maybeRepo
.
get
();
if
(!
repo
.
getUrl
().
equals
(
url
))
{
LOG
.
warning
(
"URL of imported repository ("
+
repo
.
getUrl
()
+
") does not match given URL ("
+
url
+
"). Proceeding anyway."
);
}
if
(
fetch
&&
!
repo
.
fetch
())
{
LOG
.
warning
(
"Could not fetch "
+
repo
+
". It may be out of date."
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment