MINOR Fixed whitespace and greedy regex problems in changelog generator

This commit is contained in:
Ingo Schommer 2011-10-18 09:51:14 +02:00
parent 8b08fa2058
commit ba55351c95

View File

@ -169,9 +169,10 @@ class CreateChangelog extends SilverStripeBuildTask {
$arr = array(); $arr = array();
$parts = explode('|||', $commit); $parts = explode('|||', $commit);
foreach($parts as $part) { foreach($parts as $part) {
preg_match('/(.*)\:(.*)/', $part, $matches); preg_match('/([^:]*)\:(.*)/', $part, $matches);
$arr[$matches[1]] = $matches[2]; $arr[$matches[1]] = $matches[2];
} }
return $arr; return $arr;
} }
@ -229,6 +230,7 @@ class CreateChangelog extends SilverStripeBuildTask {
$logForPath = explode("\n", $this->gitLog($path)); $logForPath = explode("\n", $this->gitLog($path));
} }
foreach($logForPath as $commit) { foreach($logForPath as $commit) {
if(!$commit) continue;
$commitArr = $this->commitToArray($commit); $commitArr = $this->commitToArray($commit);
$commitArr['path'] = $path; $commitArr['path'] = $path;
// Avoid duplicates by keying on hash // Avoid duplicates by keying on hash
@ -266,6 +268,7 @@ class CreateChangelog extends SilverStripeBuildTask {
//and generate markdown (add list to beginning of each item) //and generate markdown (add list to beginning of each item)
$output = "\n"; $output = "\n";
foreach($groupedLog as $groupName => $commits) { foreach($groupedLog as $groupName => $commits) {
if(!$commits) continue;
$output .= "\n### $groupName\n\n"; $output .= "\n### $groupName\n\n";