From 50bbb8f65ccdc10c92a46595790f5d9185e82cfd Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Sat, 12 Aug 2023 20:59:25 -0400 Subject: [PATCH 1/3] Update help for rsync --include option --- src/Command/Mount/MountDownloadCommand.php | 2 +- src/Command/Mount/MountUploadCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Mount/MountDownloadCommand.php b/src/Command/Mount/MountDownloadCommand.php index 4880a19fd..db78d82b6 100644 --- a/src/Command/Mount/MountDownloadCommand.php +++ b/src/Command/Mount/MountDownloadCommand.php @@ -29,7 +29,7 @@ protected function configure() ->addOption('source-path', null, InputOption::VALUE_NONE, "Use the mount's source path (rather than the mount path) as a subdirectory of the target, when --all is used") ->addOption('delete', null, InputOption::VALUE_NONE, 'Whether to delete extraneous files in the target directory') ->addOption('exclude', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'File(s) to exclude from the download (pattern)') - ->addOption('include', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'File(s) to include in the download (pattern)') + ->addOption('include', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'File(s) not to exclude (pattern)') ->addOption('refresh', null, InputOption::VALUE_NONE, 'Whether to refresh the cache'); $this->addProjectOption(); $this->addEnvironmentOption(); diff --git a/src/Command/Mount/MountUploadCommand.php b/src/Command/Mount/MountUploadCommand.php index 02fd0d3e1..da62dd291 100644 --- a/src/Command/Mount/MountUploadCommand.php +++ b/src/Command/Mount/MountUploadCommand.php @@ -25,7 +25,7 @@ protected function configure() ->addOption('mount', 'm', InputOption::VALUE_REQUIRED, 'The mount (as an app-relative path)') ->addOption('delete', null, InputOption::VALUE_NONE, 'Whether to delete extraneous files in the mount') ->addOption('exclude', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'File(s) to exclude from the upload (pattern)') - ->addOption('include', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'File(s) to include in the upload (pattern)') + ->addOption('include', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'File(s) not to exclude (pattern)') ->addOption('refresh', null, InputOption::VALUE_NONE, 'Whether to refresh the cache'); $this->addProjectOption(); $this->addEnvironmentOption(); From 5c02cd3d3d28396f8e994f30b35e3f074a543b27 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Fri, 18 Aug 2023 17:30:03 -0400 Subject: [PATCH 2/3] Use --include before --exclude in rsync commands --- src/Service/Rsync.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Service/Rsync.php b/src/Service/Rsync.php index fcd63e689..0922ab06a 100644 --- a/src/Service/Rsync.php +++ b/src/Service/Rsync.php @@ -128,7 +128,17 @@ private function doSync($from, $to, array $options = []) if (!empty($options['delete'])) { $params[] = '--delete'; } - foreach (['exclude', 'include'] as $option) { + + // Add include and exclude rules. + // + // The --include option should be placed before --exclude. From the + // rsync manual: + // "The order of the rules is important because the first rule that + // matches is the one that takes effect. Thus, if an early rule + // excludes a file, no include rule that comes after it can have any + // effect. This means that you must place any include overrides + // somewhere prior to the exclude that it is intended to limit. + foreach (['include', 'exclude'] as $option) { if (!empty($options[$option])) { foreach ($options[$option] as $value) { $params[] = '--' . $option . '=' . $value; From 1dcb85dd77c509d761862d1df47a8914ec6c377f Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Fri, 18 Aug 2023 17:31:37 -0400 Subject: [PATCH 3/3] " --- src/Service/Rsync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/Rsync.php b/src/Service/Rsync.php index 0922ab06a..d479c989d 100644 --- a/src/Service/Rsync.php +++ b/src/Service/Rsync.php @@ -137,7 +137,7 @@ private function doSync($from, $to, array $options = []) // matches is the one that takes effect. Thus, if an early rule // excludes a file, no include rule that comes after it can have any // effect. This means that you must place any include overrides - // somewhere prior to the exclude that it is intended to limit. + // somewhere prior to the exclude that it is intended to limit." foreach (['include', 'exclude'] as $option) { if (!empty($options[$option])) { foreach ($options[$option] as $value) {