From 3c46b7734ff20287991cbdf81f56702ec658c23c Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Fri, 6 Nov 2009 15:58:21 +0100 Subject: [PATCH] Added the ability to use the username of a user to link a git commit. --- src/IDF/Scm/Git.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index 395ae5b..e1e94a4 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -191,9 +191,14 @@ class IDF_Scm_Git extends IDF_Scm if (!preg_match('/<(.*)>/', $author, $match)) { return null; } - $sql = new Pluf_SQL('email=%s', array($match[1])); - $users = Pluf::factory('Pluf_User')->getList(array('filter'=>$sql->gen())); - return ($users->count() > 0) ? $users[0] : null; + foreach (array('email', 'login') as $what) { + $sql = new Pluf_SQL($what.'=%s', array($match[1])); + $users = Pluf::factory('Pluf_User')->getList(array('filter'=>$sql->gen())); + if ($users->count() > 0) { + return $users[0]; + } + } + return null; } public static function getAnonymousAccessUrl($project)