-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Include port in GitRemote origin (#4393)
* fix: Include port in GitRemote origin * Cache GitRemote origins with port if present
- Loading branch information
1 parent
b453525
commit d028592
Showing
2 changed files
with
34 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,19 +27,19 @@ public class GitRemoteTest { | |
https://github.com/org/repo, github.com, org/repo, org, repo | ||
[email protected]:org/repo.git, github.com, org/repo, org, repo | ||
ssh://github.com/org/repo.git, github.com, org/repo, org, repo | ||
https://gitlab.com/group/repo.git, gitlab.com, group/repo, group, repo | ||
https://gitlab.com/group/subgroup/subergroup/subestgroup/repo.git, gitlab.com, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
[email protected]:group/subgroup/subergroup/subestgroup/repo.git, gitlab.com, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
ssh://[email protected]:22/group/subgroup/subergroup/subestgroup/repo.git, gitlab.com, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
ssh://[email protected]:22/group/subgroup/subergroup/subestgroup/repo.git, gitlab.com:22, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
https://bitbucket.org/PRJ/repo, bitbucket.org, PRJ/repo, PRJ, repo | ||
[email protected]:PRJ/repo.git, bitbucket.org, PRJ/repo, PRJ, repo | ||
ssh://bitbucket.org/PRJ/repo.git, bitbucket.org, PRJ/repo, PRJ, repo | ||
https://[email protected]/org/project/_git/repo, dev.azure.com, org/project/repo, org/project, repo | ||
https://dev.azure.com/org/project/_git/repo, dev.azure.com, org/project/repo, org/project, repo | ||
[email protected]:v3/org/project/repo, dev.azure.com, org/project/repo, org/project, repo | ||
ssh://ssh.dev.azure.com:22/v3/org/project/repo, dev.azure.com, org/project/repo, org/project, repo | ||
""") | ||
void parseKnownRemotes(String cloneUrl, String expectedOrigin, String expectedPath, String expectedOrganization, String expectedRepositoryName) { | ||
GitRemote.Parser parser = new GitRemote.Parser(); | ||
|
@@ -53,9 +53,11 @@ void parseKnownRemotes(String cloneUrl, String expectedOrigin, String expectedPa | |
@ParameterizedTest | ||
@CsvSource(textBlock = """ | ||
https://scm.company.com/stash/scm/org/repo.git, scm.company.com/stash/scm, org/repo, org, repo | ||
https://scm.company.com:1234/stash/scm/org/repo.git, scm.company.com:1234/stash/scm, org/repo, org, repo | ||
[email protected]:stash/org/repo.git, scm.company.com/stash, org/repo, org, repo | ||
ssh://scm.company.com/stash/org/repo, scm.company.com/stash, org/repo, org, repo | ||
https://scm.company.com:1234/very/long/context/path/org/repo.git, scm.company.com:1234/very/long/context/path, org/repo, org, repo | ||
[email protected]:very/long/context/path/org/repo.git, scm.company.com/very/long/context/path, org/repo, org, repo | ||
""") | ||
void parseUnknownRemote(String cloneUrl, String expectedOrigin, String expectedPath, String expectedOrganization, String expectedRepositoryName) { | ||
|
@@ -70,15 +72,19 @@ void parseUnknownRemote(String cloneUrl, String expectedOrigin, String expectedP | |
@ParameterizedTest | ||
@CsvSource(textBlock = """ | ||
https://scm.company.com/stash/scm/org/repo.git, scm.company.com/stash, Bitbucket, org/repo, org, repo | ||
https://scm.company.com:1234/stash/scm/org/repo.git, scm.company.com:1234/stash, Bitbucket, org/repo, org, repo | ||
[email protected]:stash/org/repo.git, scm.company.com/stash, Bitbucket, org/repo, org, repo | ||
ssh://scm.company.com/stash/org/repo, scm.company.com/stash, Bitbucket, org/repo, org, repo | ||
https://scm.company.com/very/long/context/path/org/repo.git, scm.company.com/very/long/context/path, Bitbucket, org/repo, org, repo | ||
https://scm.company.com:1234/very/long/context/path/org/repo.git, scm.company.com:1234/very/long/context/path, Bitbucket, org/repo, org, repo | ||
[email protected]:very/long/context/path/org/repo.git, scm.company.com/very/long/context/path, Bitbucket, org/repo, org, repo | ||
https://scm.company.com/group/subgroup/subergroup/subestgroup/repo, scm.company.com, GitLab, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
https://scm.company.com:1234/group/subgroup/subergroup/subestgroup/repo, scm.company.com:1234, GitLab, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
[email protected]:group/subgroup/subergroup/subestgroup/repo.git, scm.company.com, GitLab, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
ssh://scm.company.com:22/group/subgroup/subergroup/subestgroup/repo.git, scm.company.com, GitLab, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
ssh://scm.company.com:22/group/subgroup/subergroup/subestgroup/repo.git, scm.company.com:22, GitLab, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
https://scm.company.com/very/long/context/path/group/subgroup/subergroup/subestgroup/repo, scm.company.com/very/long/context/path, GitLab, group/subgroup/subergroup/subestgroup/repo, group/subgroup/subergroup/subestgroup, repo | ||
""") | ||
void parseRegisteredRemote(String cloneUrl, String origin, GitRemote.Service service, String expectedPath, String expectedOrganization, String expectedRepositoryName) { | ||
|