Code Monkey home page Code Monkey logo

Comments (6)

pjcdawkins avatar pjcdawkins commented on June 3, 2024

If --include is used without an --exclude, always append '--exclude=*' as it will not work otherwise

Does it depend what you expect --include to do? Both your examples ended up syncing the .txt files that were requested.

man rsync says:

  --include=PATTERN        don't exclude files matching PATTERN

Exclude before include makes sense

from legacy-cli.

akalipetis avatar akalipetis commented on June 3, 2024

Does it depend what you expect --include to do? Both your examples ended up syncing the .txt files that were requested.

Yes, that's intended for rsync, but our help message mentions:

      --include=INCLUDE              File(s) to include in the download (pattern) (multiple values allowed)

Personally, I would expect --include to only include the given pattern.

from legacy-cli.

pjcdawkins avatar pjcdawkins commented on June 3, 2024
  1. Include --exclude argument before --include

It looks like we already do this part:

foreach (['exclude', 'include'] as $option) {
if (!empty($options[$option])) {
foreach ($options[$option] as $value) {
$params[] = '--' . $option . '=' . $value;

from legacy-cli.

akalipetis avatar akalipetis commented on June 3, 2024

Yes, you're correct. I messed up the order - it seems like the correct order is the opposite one (include before exclude).

PLATFORMSH_CLI_DEBUG=1 platform mount:download -m .cache --target .cache --yes --include='*.txt' --exclude='*'
...
# Running command: 'rsync' '--archive' '--compress' '--human-readable' '-vv' 'XXX:.cache/' '.cache' '--exclude=*' '--include=*.txt'
...
[sender] hiding file one.txt because of pattern *
[sender] hiding file two.pdf because of pattern *

What we'd like to do is:

'rsync' '--archive' '--compress' '--human-readable' '-vv' 'XXX:.cache/' '.cache' '--include=*.txt' '--exclude=*'
...
[sender] showing file one.txt because of pattern *.txt
[sender] hiding file two.pdf because of pattern *

from legacy-cli.

pjcdawkins avatar pjcdawkins commented on June 3, 2024

OK reading deeper in the man page:

   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.

from legacy-cli.

pjcdawkins avatar pjcdawkins commented on June 3, 2024

I've updated the PR #1304 to address that

from legacy-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.