Skip to content

Commit

Permalink
fix(downloader): Support Git URLs with '.git' in domain
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Salmi <Syyllinen@users.noreply.github.com>
  • Loading branch information
Syyllinen authored and sschuberth committed Jul 17, 2024
1 parent b590ad2 commit b0b1f7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion downloader/src/main/kotlin/VcsHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ enum class VcsHost(
private val SVN_BRANCH_OR_TAG_PATTERN = Regex("(.*svn.*)/(branches|tags)/([^/]+)/?(.*)")
private val SVN_TRUNK_PATTERN = Regex("(.*svn.*)/(trunk)/?(.*)")
private val GIT_REVISION_FRAGMENT = Regex("git.+#[a-fA-F0-9]{7,}")
private val GIT_PROJECT_NAME = Regex("/([^/]+)\\.git")
private val GIT_PROJECT_NAME = Regex("/([^/]+)\\.git$")

/**
* Return the applicable [VcsHost] for the given [url], or null if no applicable host is found.
Expand Down
4 changes: 4 additions & 0 deletions downloader/src/test/kotlin/VcsHostTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ class VcsHostTest : WordSpec({
VcsHost.getProject("ssh://git@gitlab.custom.com:group/project.git") shouldBe "project"
}

"work for a generic URL with .git twice to a Git repository" {
VcsHost.getProject("ssh://git@internal.gitlab.custom.com:group/project.git") shouldBe "project"
}

"handle an unknown URL" {
VcsHost.fromUrl("https://host.tld/path/to/repo") should beNull()
}
Expand Down

0 comments on commit b0b1f7c

Please sign in to comment.