-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The code to invoke the `git ls-tree` command was wrong, and resulted in the nonexisting command `git tree ls-tree` being invoked instead. This patch fixes the issue so the tree command can be used again.
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* phpGit - A Git wrapper for PHP | ||
* | ||
* @author https://github.com/inhere | ||
* @link https://github.com/phppkg/phpgit | ||
* @license MIT | ||
*/ | ||
|
||
namespace PhpGitTest\Command; | ||
|
||
use PhpGit\Exception\GitException; | ||
use PhpGit\Git; | ||
use PhpGitTest\BasePhpGitTestCase; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
|
||
class TreeTest extends BasePhpGitTestCase | ||
{ | ||
public function testListBranch(): void | ||
{ | ||
$filesystem = new Filesystem(); | ||
|
||
$git = new Git(); | ||
$git->init($this->directory); | ||
$git->setRepository($this->directory); | ||
$filesystem->dumpFile($this->directory . '/README.md', 'hello'); | ||
$git->add('.'); | ||
$git->commit('Initial commit'); | ||
|
||
$result = $git->tree('master'); | ||
|
||
$this->assertIsArray($result); | ||
$this->assertCount(1, $result); | ||
|
||
$inner = array_shift($result); | ||
|
||
$this->assertIsArray($inner); | ||
$this->assertArrayHasKey('sort', $inner); | ||
$this->assertEquals('2:README.md', $inner['sort']); | ||
|
||
$this->assertArrayHasKey('type', $inner); | ||
$this->assertEquals('blob', $inner['type']); | ||
|
||
$this->assertArrayHasKey('mode', $inner); | ||
$this->assertEquals(100644, $inner['mode']); | ||
|
||
$this->assertArrayHasKey('hash', $inner); | ||
$this->assertEquals('b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0', $inner['hash']); | ||
|
||
$this->assertArrayHasKey('file', $inner); | ||
$this->assertEquals('README.md', $inner['file']); | ||
} | ||
} |