Fix tags extraction from git repository (issue 675)

This commit is contained in:
William MARTIN 2011-05-26 09:56:04 +02:00
parent bbf1a1882a
commit 94da55d15e

View File

@ -209,7 +209,7 @@ class IDF_Scm_Git extends IDF_Scm
return $this->cache['tags']; return $this->cache['tags'];
} }
$cmd = Pluf::f('idf_exec_cmd_prefix', '') $cmd = Pluf::f('idf_exec_cmd_prefix', '')
.sprintf('GIT_DIR=%s %s for-each-ref --format="%%(taggerdate:iso)%%(committerdate:iso) %%(objectname) %%(refname)" refs/tags', .sprintf('GIT_DIR=%s %s for-each-ref --format="%%(objectname) %%(refname)" refs/tags',
escapeshellarg($this->repo), escapeshellarg($this->repo),
Pluf::f('git_path', 'git')); Pluf::f('git_path', 'git'));
self::exec('IDF_Scm_Git::getTags', $cmd, $out, $return); self::exec('IDF_Scm_Git::getTags', $cmd, $out, $return);
@ -221,15 +221,12 @@ class IDF_Scm_Git extends IDF_Scm
rsort($out); rsort($out);
$res = array(); $res = array();
foreach ($out as $b) { foreach ($out as $b) {
$elts = explode(' ', $b, 5); $elts = explode(' ', $b, 2);
$tag = substr(trim($elts[4]), 10); $tag = substr(trim($elts[1]), 10); // Remove refs/tags/ prefix
if (false !== strpos($tag, '/')) {
$res[$elts[3]] = $b;
} else {
$res[$tag] = ''; $res[$tag] = '';
} }
}
$this->cache['tags'] = $res; $this->cache['tags'] = $res;
return $res; return $res;
} }