Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple protocols and ports for a single GitRemote server and build URIs #4429

Merged
merged 14 commits into from
Aug 21, 2024

Conversation

pstreef
Copy link
Contributor

@pstreef pstreef commented Aug 19, 2024

What's changed?

In stead of manipulating URIs and matching on a simple origin, we now register multiple URIs for a remote git server. This way we can indicate the multiple protocols/ports indeed point to the same server.

What's your motivation?

We can currently get multiple origins for the same server which means we could fail to match.

Anything in particular you'd like reviewers to focus on?

the normalizeUri method

Anyone you would like to review specifically?

@bryceatmoderne

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@pstreef pstreef self-assigned this Aug 19, 2024
@timtebeek timtebeek added the enhancement New feature or request label Aug 19, 2024
@pstreef pstreef changed the title Support multiple protocols and ports for a single GitRemote server Support multiple protocols and ports for a single GitRemote server and build URIs Aug 20, 2024
@pstreef pstreef mentioned this pull request Aug 20, 2024
3 tasks
rewrite-core/src/main/java/org/openrewrite/GitRemote.java Outdated Show resolved Hide resolved
public Parser registerRemote(Service service, String origin) {
if (origin.startsWith("https://") || origin.startsWith("http://") || origin.startsWith("ssh://")) {
origin = new Parser.HostAndPath(origin).concat();
public URI toUri(GitRemote remote, boolean ssh) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to change the ssh parameter to protocol to allow for http or https?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think it was very useful, but it's easy to add now, harder to change later. So lets!

rewrite-core/src/main/java/org/openrewrite/GitRemote.java Outdated Show resolved Hide resolved
rewrite-core/src/main/java/org/openrewrite/GitRemote.java Outdated Show resolved Hide resolved
@pstreef pstreef requested a review from bryceatmoderne August 20, 2024 14:46
@pstreef pstreef merged commit 86fd31c into main Aug 21, 2024
2 checks passed
@pstreef pstreef deleted the feat/register-multiple-uris-for-git-remote-server branch August 21, 2024 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants