in maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/main/java/org/apache/maven/scm/provider/git/repository/GitScmProviderRepository.java [107:156]
public GitScmProviderRepository(String url) throws ScmException {
if (url == null) {
throw new ScmException("url must not be null");
}
if (url.startsWith(URL_DELIMITER_FETCH)) {
String fetch = url.substring(URL_DELIMITER_FETCH.length());
int indexPushDelimiter = fetch.indexOf(URL_DELIMITER_PUSH);
if (indexPushDelimiter >= 0) {
String push = fetch.substring(indexPushDelimiter + URL_DELIMITER_PUSH.length());
pushInfo = parseUrl(push);
fetch = fetch.substring(0, indexPushDelimiter);
}
fetchInfo = parseUrl(fetch);
if (pushInfo == null) {
pushInfo = fetchInfo;
}
} else if (url.startsWith(URL_DELIMITER_PUSH)) {
String push = url.substring(URL_DELIMITER_PUSH.length());
int indexFetchDelimiter = push.indexOf(URL_DELIMITER_FETCH);
if (indexFetchDelimiter >= 0) {
String fetch = push.substring(indexFetchDelimiter + URL_DELIMITER_FETCH.length());
fetchInfo = parseUrl(fetch);
push = push.substring(0, indexFetchDelimiter);
}
pushInfo = parseUrl(push);
if (fetchInfo == null) {
fetchInfo = pushInfo;
}
} else {
fetchInfo = pushInfo = parseUrl(url);
}
// set the default values for backward compatibility from the push url
// because it's more likely that the push URL contains 'better' credentials
setUser(pushInfo.getUserName());
setPassword(pushInfo.getPassword());
setHost(pushInfo.getHost());
if (pushInfo.getPort() != null && pushInfo.getPort().length() > 0) {
setPort(Integer.parseInt(pushInfo.getPort()));
}
}