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.
feature.issue-of-others
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

@ -37,6 +37,8 @@ or newer to properly run this version of Indefero!
and only display this list if there are any branches available for all SCMs
- If git's author name is not encoded in an UTF-8 compatible encoding, skip the author lookup,
as we have no information what the author string is actually encoded in
- Indefero no longer displays an empty parents paragraph in the commit view for root revisions of
a git repository
## Documentation

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;