Skip to content

Commit

Permalink
Merge branch 'submodule'
Browse files Browse the repository at this point in the history
  • Loading branch information
patrikf committed Feb 12, 2011
2 parents bc0cb74 + 3a3bd0c commit bce429a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/git_tree.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function _unserialize($data)
list($node->mode, $node->name) = explode(' ', substr($data, $start, $pos-$start), 2);
$node->mode = intval($node->mode, 8);
$node->is_dir = !!($node->mode & 040000);
$node->is_submodule = ($node->mode == 57344);
$node->object = substr($data, $pos+1, 20);
$start = $pos+21;

Expand Down Expand Up @@ -122,12 +123,23 @@ public function listRecursive()
{
if ($node->is_dir)
{
$subtree = $this->repo->getObject($node->object);
foreach ($subtree->listRecursive() as $entry => $blob)
$r[$node->name . '/' . $entry] = $blob;
if ($node->is_submodule)
{
$r[$node->name. ':submodule'] = $node->object;
}
else
{
$subtree = $this->repo->getObject($node->object);
foreach ($subtree->listRecursive() as $entry => $blob)
{
$r[$node->name . '/' . $entry] = $blob;
}
}
}
else
{
$r[$node->name] = $node->object;
}
}

return $r;
Expand Down

0 comments on commit bce429a

Please sign in to comment.