diff --git a/composer-lock-diff b/composer-lock-diff index 7660e93..e8cbc09 100755 --- a/composer-lock-diff +++ b/composer-lock-diff @@ -214,6 +214,12 @@ function makeCompareUrl($pkg, $diff) { } function getSourceRepoType($url) { + if (preg_match('/^git@bitbucket.org:(.*)\.git$/', $url)) { + return 'bitbucket'; + } + if (preg_match('/^git@github.com:(.*)\.git$/', $url)) { + return 'github'; + } if (! preg_match('/^http/i', $url)) { return 'unknown'; } @@ -236,11 +242,13 @@ function formatCompareUnknown($url, $from, $to) { } function formatCompareGithub($url, $from, $to) { - return sprintf('%s/compare/%s...%s', preg_replace('/\.git$/', '', $url), urlencode($from), urlencode($to)); + $url = preg_replace(['/\.git$/', '/^git@github.com:/'], ['', 'https://github.com/'], $url); + return sprintf('%s/compare/%s...%s', $url, urlencode($from), urlencode($to)); } function formatCompareBitbucket($url, $from, $to) { - return sprintf('%s/branches/compare/%s%%0D%s', preg_replace('/\.git$/', '', $url), urlencode($from), urlencode($to)); + $url = preg_replace(['/\.git$/', '/^git@bitbucket.org:/'], ['', 'https://bitbucket.org/'], $url); + return sprintf('%s/branches/compare/%s%%0D%s', $url, urlencode($to), urlencode($from)); } function formatCompareGitlab($url, $from, $to) {