diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index 508a2aba0..e775dd269 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -163,8 +163,12 @@ class GitLabDriver extends VcsDriver if ($composer) { // specials for gitlab (this data is only available if authentication is provided) - if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) { - $composer['support']['issues'] = $this->project['_links']['issues']; + if (!isset($composer['support']['source']) && isset($this->project['web_url'])) { + $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier; + $composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label); + } + if (!isset($composer['support']['issues']) && !empty($this->project['issues_enabled']) && isset($this->project['web_url'])) { + $composer['support']['issues'] = sprintf('%s/-/issues', $this->project['web_url']); } if (!isset($composer['abandoned']) && !empty($this->project['archived'])) { $composer['abandoned'] = true; diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php index f06a26526..fd6f2936d 100644 --- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php @@ -95,6 +95,8 @@ class GitLabDriverTest extends TestCase "id": 17, "default_branch": "mymaster", "visibility": "private", + "issues_enabled": true, + "archived": false, "http_url_to_repo": "https://gitlab.com/mygroup/myproject.git", "ssh_url_to_repo": "git@gitlab.com:mygroup/myproject.git", "last_activity_at": "2014-12-01T09:17:51.000+01:00",