예제 #1
0
파일: GitRepo.php 프로젝트: totten/git-scan
 /**
  * @return string 40-character hexadecimal commit name
  * @throws \RuntimeException
  */
 public function getCommit()
 {
     $process = $this->command("git rev-parse HEAD");
     $process->run();
     if ($process->isSuccessful()) {
         $commit = trim($process->getOutput());
         if (!\GitScan\Util\Commit::isValid($commit)) {
             throw new \RuntimeException("Malformed commit [{$commit}]");
         }
         return $commit;
     } else {
         throw new \RuntimeException("Failed to determine commit");
     }
 }
예제 #2
0
 /**
  * Assert that $commit looks like a real commit.
  *
  * @param string $commit
  */
 public function assertIsCommit($commit)
 {
     $this->assertTrue(\GitScan\Util\Commit::isValid($commit));
 }