Skip to content
Permalink
Browse files

VCS: Support URLs ending with ".git" in `splitUrl()`

Add handling of URLs ending with ".git" to the `splitUrl()` function.
Previously, the `VcsType` of such URLs could not be detected.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
  • Loading branch information...
mnonnenmacher committed Sep 3, 2019
1 parent 9fded2a commit a3d94501839beb145048209a96c72bc500c47066
@@ -222,6 +222,10 @@ abstract class VersionControlSystem {

else -> {
when {
vcsUrl.endsWith(".git") -> {
VcsInfo(VcsType.GIT, normalizeVcsUrl(vcsUrl), "", null, "")
}

vcsUrl.contains(".git/") -> {
val url = normalizeVcsUrl(vcsUrl.substringBefore(".git/"))
val path = vcsUrl.substringAfter(".git/")
@@ -66,6 +66,19 @@ class VersionControlSystemTest : WordSpec({

"splitUrl" should {
"split paths from a URL to a Git repository" {
val actual = VersionControlSystem.splitUrl(
"https://git-wip-us.apache.org/repos/asf/zeppelin.git"
)
val expected = VcsInfo(
type = VcsType.GIT,
url = "https://git-wip-us.apache.org/repos/asf/zeppelin.git",
revision = "",
path = ""
)
actual shouldBe expected
}

"split paths from a URL to a Git repository with path" {
val actual = VersionControlSystem.splitUrl(
"https://git-wip-us.apache.org/repos/asf/zeppelin.git/zeppelin-interpreter"
)

0 comments on commit a3d9450

Please sign in to comment.
You can’t perform that action at this time.