diff --git a/src/GitList/Exception/BlankDataException.php b/src/GitList/Exception/BlankDataException.php index f11fb4e..1293fbb 100644 --- a/src/GitList/Exception/BlankDataException.php +++ b/src/GitList/Exception/BlankDataException.php @@ -2,4 +2,7 @@ namespace GitList\Exception; -class BlankDataException extends \RuntimeException {} +class BlankDataException extends \RuntimeException +{ + +} diff --git a/src/GitList/Exception/EmptyRepositoryException.php b/src/GitList/Exception/EmptyRepositoryException.php new file mode 100644 index 0000000..027a4d7 --- /dev/null +++ b/src/GitList/Exception/EmptyRepositoryException.php @@ -0,0 +1,8 @@ +getBranches(); $tags = $repository->getTags(); @@ -59,11 +58,11 @@ class Routing } } - $commitish = $matchedBranch; - } + if ($matchedBranch === null) { + throw new EmptyRepositoryException('This repository is currently empty. There are no commits.'); + } - if ($commitish === null) { - $app->abort(404, "'$branch_path' does not appear to contain a commit-ish for '$repo'."); + $commitish = $matchedBranch; } $commitishLength = strlen($commitish);