summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/index.php b/index.php
index 463af36..a5342f8 100644
--- a/index.php
+++ b/index.php
@@ -2,10 +2,11 @@
function find_projects(string $path, array $projects = []): array {
$directories = glob($path . "/{.[!.],}*", GLOB_ONLYDIR | GLOB_BRACE);
- foreach ($directories as $directory) {
- if (str_ends_with($directory, ".git")) {
- $projects[] = substr($directory, 0, -4);
- } else {
+ if (($idx = array_search("$path/.git", $directories)) !== false) {
+ $projects[] = substr($directories[$idx], 0, -4);
+ }
+ else {
+ foreach ($directories as $directory) {
$projects += find_projects($directory, $projects);
}
}