diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index f00af82..e32e49a 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -61,20 +61,19 @@ class Routing if ($matchedBranch !== null) { $commitish = $matchedBranch; } - } - - if ($commitish === null) { - // We may have partial commit hash as our commitish. - $hash = $slashPosition === false ? $commitishPath : substr($commitishPath, 0, $slashPosition); - if ($repository->hasCommit($hash)) { - $commit = $repository->getCommit($hash); - $commitish = $commit->getHash(); + else + { + // We may have partial commit hash as our commitish. + $hash = $slashPosition === false ? $commitishPath : substr($commitishPath, 0, $slashPosition); + if ($repository->hasCommit($hash)) { + $commit = $repository->getCommit($hash); + $commitish = $commit->getHash(); + } + else + throw new EmptyRepositoryException('This repository is currently empty. There are no commits.'); } } - if ($commitish === null) { - throw new EmptyRepositoryException('This repository is currently empty. There are no commits.'); - } $commitishLength = strlen($commitish); $path = substr($commitishPath, $commitishLength);