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: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.