mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 03:00:59 +01:00
Shorter and less condition
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user