Skip to content

Commit

Permalink
Add guard clause
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 17, 2016
1 parent 21a2b2a commit 8d6fe26
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/CLI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ private function executeSingle(InputInterface $input, OutputInterface $output)
*/
private function executeHistory(InputInterface $input, OutputInterface $output)
{
if (!is_dir($input->getOption('git-repository'))) {
throw new RuntimeException(
sprintf(
'Working directory "%s" does not exist',
$input->getOption('git-repository')
)
);
}

$git = new Git($input->getOption('git-repository'));

if (!$git->isWorkingCopyClean()) {
Expand Down

0 comments on commit 8d6fe26

Please sign in to comment.