com karma: possibly fix for "Allowed memory size exhausted " error: lib/Git/ReceiveHook.php
| From: | Alexander Moskaliov | Date: | Thu, 22 Mar 2012 19:11:40 +0000 |
| Subject: | com karma: possibly fix for "Allowed memory size exhausted " error: lib/Git/ReceiveHook.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68151@lists.php.net to get a copy of this message | ||
Commit: b6b01b9106a29aefe97dcab12c39501ff4ecdb69
Author: Alexander Moskaliov <irker@php.net> Thu, 22 Mar 2012 23:11:40 +0400
Parents: d518a6a76e347636432deb6f415f411dbcd780f0
Branches: master
Link: http://git.php.net/?p=karma.git;a=commitdiff;h=b6b01b9106a29aefe97dcab12c39501ff4ecdb69
Log:
possibly fix for "Allowed memory size exhausted " error
Changed paths:
M lib/Git/ReceiveHook.php
Diff:
b6b01b9106a29aefe97dcab12c39501ff4ecdb69
diff --git a/lib/Git/ReceiveHook.php b/lib/Git/ReceiveHook.php
index 0c0bcf1..e4e879a 100644
--- a/lib/Git/ReceiveHook.php
+++ b/lib/Git/ReceiveHook.php
@@ -84,11 +84,13 @@ abstract class ReceiveHook
{
$raw = \Git::gitExec('show --name-status --pretty="format:" %s',
$revRange);
$paths = [];
- if (preg_match_all('/([ACDMRTUXB*]+)\s+([^\n\s]+)/', $raw , $matches,
PREG_SET_ORDER)) {
- foreach($matches as $item) {
- $paths[$item[2]] = $item[1];
+ $lines = explode("\n", $raw);
+ foreach($lines as $line) {
+ if (preg_match('/([ACDMRTUXB*]+)\s+([^\n\s]+)/', $line , $matches)) {
+ $paths[$matches[2]] = $matches[1];
}
}
+
return $paths;
}