Skip to content

Commit

Permalink
Add full cloneUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
pstreef committed Aug 2, 2024
1 parent b331cef commit 3d5d541
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public String cleanHostAndPath(String url) {
@Override
public CloneUrl parseCloneUrl(String cloneUrl) {
CloneUrl parsed = Scm.super.parseCloneUrl(cloneUrl);
return new AzureDevopsCloneUrl(parsed.getOrigin(), parsed.getPath());
return new AzureDevopsCloneUrl(cloneUrl, getOrigin(), parsed.getPath());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@Value
public class AzureDevopsCloneUrl implements CloneUrl {
String cloneUrl;
String origin;
String path;

Expand Down
2 changes: 2 additions & 0 deletions rewrite-core/src/main/java/org/openrewrite/scm/CloneUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

public interface CloneUrl {

String getCloneUrl();

String getOrigin();

String getPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

@Value
public class GitLabCloneUrl implements CloneUrl {
String cloneUrl;
String origin;
String path;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public String cleanHostAndPath(String url) {
@Override
public CloneUrl parseCloneUrl(String cloneUrl) {
CloneUrl parsed = Scm.super.parseCloneUrl(cloneUrl);
return new GitLabCloneUrl(parsed.getOrigin(), parsed.getPath());
return new GitLabCloneUrl(cloneUrl, getOrigin(), parsed.getPath());
}
}
4 changes: 2 additions & 2 deletions rewrite-core/src/main/java/org/openrewrite/scm/Scm.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ default boolean belongsToScm(String cloneUrl) {

default CloneUrl parseCloneUrl(String cloneUrl) {
if (cloneUrl.length() < getOrigin().length() + 1) {
return new SimpleCloneUrl(getOrigin(), "");
return new SimpleCloneUrl(cloneUrl, getOrigin(), "");
}
String path = cleanHostAndPath(cloneUrl).substring(getOrigin().length() + 1);
return new SimpleCloneUrl(getOrigin(), path);
return new SimpleCloneUrl(cloneUrl, getOrigin(), path);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

@Value
public class SimpleCloneUrl implements CloneUrl{
String cloneUrl;
String origin;
String path;
}

0 comments on commit 3d5d541

Please sign in to comment.