/** * run a git command inside a local Git repository * * @param string $repoDir * the location of the Git repo * @param array|Traversable $command * the command to run * @param EventStream|null $eventStream * the (optional) stream to send events to * @return ProcessResult * the result of running the command */ public static function run($repoDir, $command, EventStream $eventStream = null) { // defensive programming! RequireGitRepo::check($repoDir); // run the command return PopenProcessRunner::run($command, null, $repoDir, $eventStream); }
/** * @covers ::check * @expectedException GanbaroDigital\GitRepo\Exceptions\E4xx_NotGitRepo */ public function testThrowsExceptionWhenGivenAFolderOutsideGitRepo() { // ---------------------------------------------------------------- // setup your test // // we need a system folder, because it's certain to be a non-git // repo if (is_dir("/usr")) { $repoDir = "/usr"; } else { if (is_dir("c:\\")) { $repoDir = "c:\\"; } } // ---------------------------------------------------------------- // perform the change RequireGitRepo::check($repoDir); }