File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Check for Git2\TreeBuilder::construct
3+ --SKIPIF--
4+ <?php if (!extension_loaded ("git2 " )) print "skip " ; ?>
5+ --FILE--
6+ <?php
7+ $ path = __DIR__ . '/mock/007-02 ' ;
8+ if (file_exists ($ path )) {
9+ `rm -rf {$ path }`;
10+ }
11+
12+ $ repo = Git2 \Repository::init ($ path ,true );
13+
14+ $ bld = new Git2 \TreeBuilder ();
15+ $ bld ->insert (new Git2 \TreeEntry (array (
16+ "name " => "README.txt " ,
17+ "oid " => "63542fbea05732b78711479a31557bd1b0aa2116 " ,
18+ "attributes " => 33188 ,
19+ )));
20+ $ oid = $ bld ->write ($ repo );
21+ echo $ oid . PHP_EOL ;
22+ if (is_file ($ path . "/objects/75/b9737032278849da7e57829164a1265911afda " )) {
23+ echo "PASS " . PHP_EOL ;
24+ } else {
25+ echo "FAIL " . PHP_EOL ;
26+ }
27+ echo `GIT_DIR= {$ path } git ls-tree 75b9737032278849da7e57829164a1265911afda `;
28+ `rm -rf {$ path }`;
29+ --EXPECT --
30+ 75 b9737032278849da7e57829164a1265911afda
31+ PASS
32+ 100644 blob 63542 fbea05732b78711479a31557bd1b0aa2116 README .txt
You can’t perform that action at this time.
0 commit comments