From 7fada892ca266780d56b2a1feab5af78c5d325b5 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 21 Sep 2017 00:53:42 +1000 Subject: [PATCH] Fixed git subdirs removal. --- src/ArtefactTrait.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ArtefactTrait.php b/src/ArtefactTrait.php index 6f8470b..02d1a43 100644 --- a/src/ArtefactTrait.php +++ b/src/ArtefactTrait.php @@ -261,12 +261,15 @@ protected function replaceGitignore($filename, $path) */ protected function removeSubRepos($path) { - $dirs = glob($path.DIRECTORY_SEPARATOR.'.git', GLOB_ONLYDIR); - if (!empty($dirs)) { - // Make sure that current repo's .git dir is not removed. - $dirs = array_diff($dirs, [$path.DIRECTORY_SEPARATOR.'.git']); - $this->fsFileSystem->remove($dirs); - } + $dirs = $this->fsFinder + ->in($path) + ->name('/\.git$/') + ->ignoreDotFiles(false) + ->ignoreVCS(false) + ->notPath('vendor') + ->depth('>1'); + + $this->fsFileSystem->remove($dirs); } /**