Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude rules are too greedy #777

Open
pdewouters opened this issue Mar 27, 2015 · 12 comments
Open

Exclude rules are too greedy #777

pdewouters opened this issue Mar 27, 2015 · 12 comments
Labels

Comments

@pdewouters
Copy link
Contributor

I'm having trouble understanding the logic behind the exclude_string function.
For example, I added an exclude rule as cache/ thinking it would exclude any subdirectory named cache, but it actually excludes anything that has the pattern cache in it.

screen shot 2015-03-27 at 20 16 12

which was wrongly excluding some folders and files:

screen shot 2015-03-27 at 20 18 42

I think we need a separate case for fragments in the exclude_string function?

Currently, when a user excludes a folder or file via the admin, we use an absolute path, but the default excludes array are wildcard patterns.

@pdewouters pdewouters changed the title exclude a subdirectory Recursively exclude a subdirectory matching a pattern Mar 27, 2015
@pdewouters
Copy link
Contributor Author

I found these quite clear. Maybe we can use

 What are exclude patterns?

Patterns allow you to exclude parts of your repository from being deployed. You can exclude files or folders containing a certain word, extension and more.

Here are some example patterns

Exclude all files with the extension "txt":

**/*.txt

Exclude all files with the extension "txt" in the folder "folder1":

/folder1/*.txt

Exclude all files with the name test.pdf below the folder "hello" and any subfolder:

/hello/**/test.pdf

Exclude files or folders containing the word "name":

*name*

Exclude files containing the word "name" and the extension "txt":

*name*.txt

Exclude files or folders with name n?me, where ? can be any character:

n?me

Exclude all files or folders containing the word "beta":

**/*beta*

Exclude all files or folders containing the word "experiment" in the folder "folder1":

/folder1/*experiment*

Exclude all files or folders containing the word "develop" below the folder "hello" and any subfolder:

/hello/**/*develop*

@willmot
Copy link
Contributor

willmot commented Jul 17, 2015

Would be good to narrow this down to the specific issue with excludes.

I think it's that currently foo/ matches *foo/ when intuitively it should probably only match */foo/. That is it should match any folder called foo regardless of where it is instead of matching any path that contains *foo/ which is what currently happens?

@willmot
Copy link
Contributor

willmot commented Jul 17, 2015

Also we should prove this with Unit Tests as exclude rule matching is well tested, it's just that maybe the assumptions are wrong

@willmot willmot modified the milestone: Future Release Jul 17, 2015
@willmot willmot added this to the Future Release milestone Mar 16, 2016
@willmot willmot changed the title Recursively exclude a subdirectory matching a pattern Exclude rules are too greedy Aug 28, 2016
@willmot willmot added Bug and removed Enhancement labels Aug 28, 2016
@katmoody
Copy link
Contributor

Does this seem like it would be fixed in an upcoming release, then, or or will it take more time to fully isolate @willmot? Have one person who loves using the plugin but keeps having a few files excluded, which makes it less convenient if they have to do a restore. I think you figured out the *dev file pattern was the one impacting them?

@willmot
Copy link
Contributor

willmot commented Aug 30, 2016

@katmoody it's not going to be resolved quickly unfortunately, they could work around the issue by removing the exclude rule for dev from the UI and then manually excluding it's absolute path using the HMBKP_EXCLUDES constant.

e.g.

define( 'HMBKP_EXCLUDES', 'absolute_path_to_dev' );

@katmoody
Copy link
Contributor

@willmot - How do they remove the exclude rule for dev?

@willmot
Copy link
Contributor

willmot commented Aug 30, 2016

It's a rule they've added through the excludes page so should just be able to remove it like any other rule.

@katmoody
Copy link
Contributor

But they didn't add any rules to the excludes page, at all? I thought this was a default rule you had in the plugin itself?

@willmot
Copy link
Contributor

willmot commented Sep 27, 2016

@katmoody I think we chatted about this in Slack, I double checked and the user you're referring to had definitely manually excluded dev which was then causing a file which happened to include dev in its filename to be excluded.

@sambulance
Copy link
Contributor

Is this still an issue? It's in the Deployed pipeline - can we close?

@willmot
Copy link
Contributor

willmot commented Nov 30, 2016

I don't know why it's in the deployed pipeline, it's not been worked on and is an epic.

@katmoody
Copy link
Contributor

Just a note - the excludes doesn't work when excluding from the admin either? Seems to exclude by filename still :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants