`.*` glob matches files in subfolders too
DemianX0 opened this issue · 1 comments
Expected:
.*
should only match (dot) files in the root folder (local-dir
) (glob tool example)
Actual:
.*
matches all dot-files in subfolders as well.
This should happen only for **/.*
glob (glob tool example)
I assume this affects all patterns, not tested yet.
Output:
After removing the exclude glob .*
:
uploading ".htaccess"
uploading "includes/.htaccess"
uploading "languages/.htaccess"
uploading "maintenance/.htaccess"
uploading "maintenance/archives/.htaccess"
Version:
'@samkirkland/ftp-deploy': 1.1.0
This seems to be intentional, caused by matchBase: true
(docs) at
Line 10 in 5554a6f
Any glob without a /
is matched against only the file name (basename). This might be convenient in some use-cases, inconvenient in others, for ex. to exclude all .json
files in the root (such as package.json
, package-lock.json
), but not in the subfolders one has to write a complicated additional negated rule that's not documented:
- *.json
- !*/**/*.json
This is far from obvious without diving into multimatch
:
https://github.com/sindresorhus/multimatch#how-multiple-patterns-work
Other common-sense patterns I thought about don't match anything:
- /*.json
- ./*.json
- //*.json
The excludeDefaults
pattern **/.git*
(which is equivalent to .git*
with matchBase
) suggests matching filenames in subfolders should be explicitly marked. This is what I would suggest by disabling the matchBase
option or making it configurable.