Adjust GitDriver tag parsing to resolve to SHAs
parent
c0b889a78a
commit
d017e3f209
|
@ -159,9 +159,14 @@ class GitDriver extends VcsDriver
|
||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
if (null === $this->tags) {
|
if (null === $this->tags) {
|
||||||
$this->process->execute('git tag', $output, $this->repoDir);
|
$this->tags = array();
|
||||||
$output = $this->process->splitLines($output);
|
|
||||||
$this->tags = $output ? array_combine($output, $output) : array();
|
$this->process->execute('git show-ref --tags', $output, $this->repoDir);
|
||||||
|
foreach ($output = $this->process->splitLines($output) as $tag) {
|
||||||
|
if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+)$}', $tag, $match)) {
|
||||||
|
$this->tags[$match[2]] = $match[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
|
|
|
@ -252,11 +252,11 @@ class GitHubDriverTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$process->expects($this->at(2))
|
$process->expects($this->at(2))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->stringContains('git tag'));
|
->with($this->stringContains('git show-ref --tags'));
|
||||||
|
|
||||||
$process->expects($this->at(3))
|
$process->expects($this->at(3))
|
||||||
->method('splitLines')
|
->method('splitLines')
|
||||||
->will($this->returnValue(array($identifier)));
|
->will($this->returnValue(array($sha.' refs/tags/'.$identifier)));
|
||||||
|
|
||||||
$process->expects($this->at(4))
|
$process->expects($this->at(4))
|
||||||
->method('execute')
|
->method('execute')
|
||||||
|
|
Loading…
Reference in New Issue