Skip to content

Commit

Permalink
Fixed git subdirs removal.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Sep 20, 2017
1 parent 9112acb commit 7fada89
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ArtefactTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 7fada89

Please sign in to comment.