From 50bda8de10421e02d66d836e8c832938e38b2b68 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Wed, 17 Jun 2009 12:00:55 -0400 Subject: [PATCH] tweaks I needed for logs and patchset lists to still work and not throw warnings/errors --- framework/Vcs/lib/Horde/Vcs.php | 4 ++-- framework/Vcs/lib/Horde/Vcs/Git.php | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/framework/Vcs/lib/Horde/Vcs.php b/framework/Vcs/lib/Horde/Vcs.php index ab50b384f..7a1feec5e 100644 --- a/framework/Vcs/lib/Horde/Vcs.php +++ b/framework/Vcs/lib/Horde/Vcs.php @@ -1061,7 +1061,7 @@ abstract class Horde_Vcs_Log { protected $_rep; protected $_file; - protected $_files; + protected $_files = array(); protected $_rev; protected $_author; protected $_tags = array(); @@ -1173,7 +1173,7 @@ abstract class Horde_Vcs_Log { return is_null($file) ? $this->_files - : (isset($this->_files[$file]) ? $this->_files[$file] : null); + : (isset($this->_files[$file]) ? $this->_files[$file] : array()); } } diff --git a/framework/Vcs/lib/Horde/Vcs/Git.php b/framework/Vcs/lib/Horde/Vcs/Git.php index ca3de1f68..7722607ae 100644 --- a/framework/Vcs/lib/Horde/Vcs/Git.php +++ b/framework/Vcs/lib/Horde/Vcs/Git.php @@ -653,16 +653,10 @@ class Horde_Vcs_Log_Git extends Horde_Vcs_Log throw new Horde_Vcs_Exception('Unable to run ' . $cmd . ': ' . error_get_last()); } - $line = trim(fgets($pipe)); + //$line = trim(fgets($pipe)); while (true) { - $line = fgets($pipe); - if ($line === false) { - throw new Horde_Vcs_Exception('Unexpected end of log output'); - } - - $line = trim($line); - if ($line == '') { break; } - + $line = trim(fgets($pipe)); + if (!strlen($line)) { break; } if (strpos($line, ':') === false) { throw new Horde_Vcs_Exception('Malformed log line: ' . $line); } @@ -710,7 +704,7 @@ class Horde_Vcs_Log_Git extends Horde_Vcs_Log $log = ''; $line = fgets($pipe); - while (substr($line, 0, 1) != ':') { + while ($line !== false && substr($line, 0, 1) != ':') { $log .= $line; $line = fgets($pipe); } -- 2.11.0