Skip to content
Snippets Groups Projects
Commit 1e96e56f authored by Florian Heck's avatar Florian Heck
Browse files

add url and fallback path to imported repo

parent 75b269a5
No related branches found
No related tags found
No related merge requests found
......@@ -132,7 +132,16 @@ public class GitWrapper extends ToolWrapper {
return Optional.empty();
}
return Optional.of(new Repository(this, "", directory));
Optional<ExecRes> result = exec(directory, "config", "--get", "remote.origin.url");
Optional<String> url = result.map(res -> {
String repoUrl = null;
if (this.failed(res) || (repoUrl = res.stdOut.trim()).isEmpty()) {
// there was no remote url
repoUrl = directory.getAbsolutePath();
}
return repoUrl;
});
return Optional.of(new Repository(this, url.orElse(""), directory));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment