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());
The tree object (VersionControl_Git_Object_Tree) (Previous) Handle command (Next)
Last updated: Tue, 25 Nov 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.