Skip to content

Commit

Permalink
Fixes #978: Do not call ignorelist on the archive if it is empty. (#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Sep 8, 2020
1 parent 3df1c25 commit 3e236a9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Task/Archive/Pack.php
Expand Up @@ -206,7 +206,9 @@ protected function archiveTar($archiveFile, $items)
}

$tar_object = new \Archive_Tar($archiveFile);
$tar_object->setIgnoreList($this->ignoreList);
if (!empty($this->ignoreList)) {
$tar_object->setIgnoreList($this->ignoreList);
}
foreach ($items as $placementLocation => $filesystemLocation) {
$p_remove_dir = $filesystemLocation;
$p_add_dir = $placementLocation;
Expand Down Expand Up @@ -259,9 +261,12 @@ protected function addItemsToZip($zip, $items)
foreach ($items as $placementLocation => $filesystemLocation) {
if (is_dir($filesystemLocation)) {
$finder = new Finder();
// Add slashes so Symfony Finder patterns work like Archive_Tar ones.
$zipIgnoreList = preg_filter('/^|$/', '/', $this->ignoreList);
$finder->files()->in($filesystemLocation)->ignoreDotFiles(false)->notName($zipIgnoreList)->notPath($zipIgnoreList);
$finder->files()->in($filesystemLocation)->ignoreDotFiles(false);
if (!empty($this->ignoreList)) {
// Add slashes so Symfony Finder patterns work like Archive_Tar ones.
$zipIgnoreList = preg_filter('/^|$/', '/', $this->ignoreList);
$finder->notName($zipIgnoreList)->notPath($zipIgnoreList);
}

foreach ($finder as $file) {
// Replace Windows slashes or resulting zip will have issues on *nixes.
Expand Down

0 comments on commit 3e236a9

Please sign in to comment.