Explorar o código

Generate source urls with labels and not identifiers

Jordi Boggiano %!s(int64=13) %!d(string=hai) anos
pai
achega
740d3aa1e3
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/Composer/Repository/Vcs/GitHubDriver.php

+ 2 - 1
src/Composer/Repository/Vcs/GitHubDriver.php

@@ -144,7 +144,8 @@ class GitHubDriver extends VcsDriver
                     $composer['time'] = $commit['commit']['committer']['date'];
                 }
                 if (!isset($composer['support']['source'])) {
-                    $composer['support']['source'] = sprintf('https://github.com/%s/%s/tree/%s', $this->owner, $this->repository, $identifier);
+                    $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
+                    $composer['support']['source'] = sprintf('https://github.com/%s/%s/tree/%s', $this->owner, $this->repository, $label);
                 }
                 if (!isset($composer['support']['issues']) && $this->hasIssues) {
                     $composer['support']['issues'] = sprintf('https://github.com/%s/%s/issues', $this->owner, $this->repository);