diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-10-27 19:59:15 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-10-27 19:59:15 +0100 |
commit | b98893f7d8b7ae95955eb7d26921b81818456ce7 (patch) | |
tree | e56799cefe358f96b251930fa22e8807353f1778 /index.php | |
parent | b60a706cd38327471dba489bcc100b32c0955a6f (diff) |
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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); } } |