Skip to content

Commit

Permalink
Add remote test
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-gibson committed Sep 6, 2024
1 parent 58d8a6d commit 37ccc42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ val GitRemote.httpUrl : URL? get() {
var url = firstUrl ?: return null

url = url.trim()
.removeSuffix(".git")

// Azure supports a .git suffix on the repo name, so don't remove it.
if (!url.contains("dev.azure")) {
url = url.removeSuffix(".git")
}

// Do not try to remove the port if the URL uses the SSH protocol in the SCP syntax e.g.
// '[email protected]:foo.git' as it does not support port definitions. Attempting to remove the port
Expand Down
6 changes: 5 additions & 1 deletion src/test/kotlin/uk/co/ben_gibson/git/link/git/RemoteTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ class RemoteTest {
Arguments.of(
"xy://custom.gitlab.url/group/project.git",
"http://custom.gitlab.url/group/project"
)
),
Arguments.of(
"http://[email protected]/ben-gibson/test/_git/test.git",
"http://dev.azure.com/ben-gibson/test/_git/test.git"
),
)
}

Expand Down

0 comments on commit 37ccc42

Please sign in to comment.