Improve the 'parents' parsing for git and ignore any empty parts; also

react gracefully if we could not parse the parents for some weird reason.
This commit is contained in:
Thomas Keller
2011-08-17 20:17:14 +02:00
parent b17de014ec
commit a2c832a130
2 changed files with 7 additions and 1 deletions

View File

@@ -646,7 +646,11 @@ class IDF_Scm_Git extends IDF_Scm
$c['full_message'] = IDF_Commit::toUTF8($c['full_message']);
$c['title'] = IDF_Commit::toUTF8($c['title']);
if (isset($c['parents'])) {
$c['parents'] = explode(' ', trim($c['parents']));
$c['parents'] = preg_split('/ /', trim($c['parents']), -1, PREG_SPLIT_NO_EMPTY);
} else {
// this is actually an error state because we should _always_
// be able to parse the parents line with every git version
$c['parents'] = null;
}
$res[] = (object) $c;
return $res;