fix: Cloning projects from Azure DevOps (#522)
Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/524/head
parent
98c2cc79eb
commit
7c598014a2
|
|
@ -70,17 +70,19 @@ public class AzureDevOpsURLParser {
|
|||
throw new IllegalArgumentException(format("The given url %s is not a valid.", url));
|
||||
}
|
||||
|
||||
String project = null;
|
||||
try {
|
||||
project = matcher.group("project");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
|
||||
String repoName = matcher.group("repoName");
|
||||
if (repoName.endsWith(".git")) {
|
||||
repoName = repoName.substring(0, repoName.length() - 4);
|
||||
}
|
||||
|
||||
String project = matcher.group("project");
|
||||
if (project == null) {
|
||||
// if project is not specified, repo name must be equal to project name
|
||||
// https://dev.azure.com/<MyOrg>/<MyRepo>/_git/<MyRepo> ==
|
||||
// https://dev.azure.com/<MyOrg>/_git/<MyRepo>
|
||||
project = repoName;
|
||||
}
|
||||
|
||||
String organization = matcher.group("organization");
|
||||
String branch = matcher.group("branch");
|
||||
String tag = matcher.group("tag");
|
||||
|
|
|
|||
|
|
@ -149,11 +149,7 @@ public class AzureDevOpsUrl extends DefaultFactoryUrl {
|
|||
}
|
||||
|
||||
private StringJoiner getRepoPathJoiner() {
|
||||
StringJoiner repoPath = new StringJoiner("/").add(hostName).add(organization);
|
||||
if (project != null) {
|
||||
repoPath.add("_git");
|
||||
}
|
||||
return repoPath;
|
||||
return new StringJoiner("/").add(hostName).add(organization).add(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class AzureDevOpsURLParserTest {
|
|||
null,
|
||||
"MyTag"
|
||||
},
|
||||
{"https://MyOrg@dev.azure.com/MyOrg/_git/MyRepo", "MyOrg", null, "MyRepo", null, null},
|
||||
{"https://MyOrg@dev.azure.com/MyOrg/_git/MyRepo", "MyOrg", "MyRepo", "MyRepo", null, null},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue