Example #1
0
 /**
  * @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");
     }
 }
Example #2
0
 /**
  * Assert that $commit looks like a real commit.
  *
  * @param string $commit
  */
 public function assertIsCommit($commit)
 {
     $this->assertTrue(\GitScan\Util\Commit::isValid($commit));
 }