Exemplo n.º 1
0
Arquivo: test.php Projeto: git4p/git4p
$t = new GitTree($git);
$t->setData($arr)->store();
echo "Created {$t}\n";
$author->setTimestamp('1374058776');
$committer->setTimestamp('1374058776');
$c = new GitCommit($git);
$c->setTree($t->sha())->addParent($oc->sha())->setMessage('Update readme.')->addAuthor($author)->addCommiter($committer)->store();
echo "Created {$c}\n";
$p = $c->sha();
// Add a commit to develop
$b = new GitBlob($git);
$b->setData("Altered README.MD file!\n")->store();
echo "Created {$b}\n";
$arr = ['README.md' => $b];
$t = new GitTree($git);
$t->setData($arr)->store();
echo "Created {$t}\n";
$author->setTimestamp('1374158776');
$committer->setTimestamp('1374158776');
$c = new GitCommit($git);
$c->setTree($t->sha())->addParent($p)->setMessage('Correct readme.')->addAuthor($author)->addCommiter($committer)->store();
echo "Created {$c}\n";
$author->setTimestamp('1384158776');
$committer->setTimestamp('1384158776');
$sc = new GitCommit($git);
$sc->setTree($t->sha())->addParent($firstcommit)->addParent($c->sha())->setMessage('Merge develop into master.')->addAuthor($author)->addCommiter($committer)->store();
echo "Created {$sc}\n";
// Update develop branch's pointer
$git->updateBranch('develop', $c->sha());
$git->updateBranch('master', $sc->sha());
$tagger->setTimestamp('1374058776');