The blob object (VersionControl_Git_Object_Blob)

An instance of the VersionControl_Git_Object_Blob represents tree object in Git. It has contents of the file.

It can get via VersionControl_Git_Object_Tree

<?php

require_once 'VersionControl/Git.php';

$git = new VersionControl_Git('/home/co3k/sf/op3-ebihara');
$commits $git->getCommits();

$tree $git->getTree($commits[0]->getTree());
$tree->fetch();

$blob $tree->current();
var_dump($blob);
/*
results:

object(VersionControl_Git_Object_Blob)#304 (3) {
}
*/

The instance doesn't have any contents at the first. If you want to get contents, call the getContents() after calling the fetch() method.

<?php

require_once 'VersionControl/Git.php';

$git = new VersionControl_Git('/home/co3k/sf/op3-ebihara');
$commits $git->getCommits();

$tree $git->getTree($commits[0]->getTree());
$tree->fetch();

$blob $tree->current()->fetch();
var_dump($blob->getContent());
    Поддержать сайт на родительском проекте КГБ