libgit2/php-git

How can I commit automatically ?

Supradyn opened this issue · 2 comments

Hi!
I need to commit all files in work_dir like "git commit -a". I can't get it from docs.
And in readme.md its like:

$bld = new Git2\TreeBuilder();
$bld->insert(new Git2\TreeEntry(array(
    "name" => "README.txt",
    "oid" => "63542fbea05732b78711479a31557bd1b0aa2116",
    "attributes" => octdec('100644'),
)));
$tree = $bld->write($repo);

How can I get this oid ? It doesnt work like
$repo->hash("file-path")

sorry for late response.

please check this block. probably I didn't add filename base api so you have to read contents by hand and put it into write api.
https://github.com/chobie/kokuban/blob/master/Kokuban/GistProvider.php#L34

Currently, php-git doesn't defined GIT_OBJ_BLOB constant. so please define it in user land.
https://github.com/libgit2/libgit2/blob/d18713fb4ad1ba3d18a75272e1c1c3eb45715aba/include/git2/types.h#L73

Also, php-git uses old version of libgit2. I want to update libgit2 version foreseeable future but I have many php-extensions to maintain. so maybe It takes log time to upgrade.