Improved issue 93, memory usage.

I have been doing tracing of the memory usage using xdebug, now I am
normally below 15MB for the linux kernel instead of 35MB. Please test.
dev
Loic d'Anterroches 2009-01-06 22:56:02 +01:00
parent a30a62d48f
commit a6c42120d8
1 changed files with 4 additions and 4 deletions

View File

@ -115,7 +115,7 @@ class IDF_Scm_Git
// As we are limiting to a given folder, we need to find
// the tree corresponding to this folder.
$found = false;
foreach ($this->getTreeInfo($co->tree) as $file) {
foreach ($this->getTreeInfo($co->tree, true, $folder) as $file) {
if ($file->type == 'tree' and $file->file == $folder) {
$found = true;
$tree = $file->hash;
@ -166,16 +166,16 @@ class IDF_Scm_Git
* @param bool Do we recurse in subtrees (true)
* @return array Array of file information.
*/
public function getTreeInfo($tree, $recurse=true)
public function getTreeInfo($tree, $recurse=true, $folder='')
{
if ('tree' != $this->testHash($tree)) {
throw new Exception(sprintf(__('Not a valid tree: %s.'), $tree));
}
$cmd_tmpl = 'GIT_DIR=%s git ls-tree%s -t -l %s';
$cmd_tmpl = 'GIT_DIR=%s git ls-tree%s -t -l %s %s';
$cmd = sprintf($cmd_tmpl,
escapeshellarg($this->repo),
($recurse) ? ' -r' : '',
escapeshellarg($tree));
escapeshellarg($tree), escapeshellarg($folder));
$out = array();
$res = array();
IDF_Scm::exec($cmd, $out);