Closed vtbassmatt closed 5 years ago
I think this is actually right behavior. We follow minimatch's globbing behavior, which in turn follows fnmatch and produces the following:
minimatch("bar/foo", "(bar|abc)/**") = false
minimatch("bar/foo", "+(bar|abc)/**") = true
minimatch("bar/foo", "!(bar|abc)/**") = true
minimatch("bar/foo", "!+(bar|abc)/**") = false
So I think this should work if you change the above to !+(node_modules|.git)/**
, its currently missing the leading +
which indicates that we're entering into a pattern list
Ah, thanks. I didn't find that guide to fnmatch in my (admittedly brief) search.
I know this is super old, but this is the only thing I found online to assist me in figuring this out, so I wanted to add one other quick glob example (since fnmatch/minimatch is new to me).
In my case, I wanted to exclude a bunch of directories with the CopyFiles task, and some were subdirs.
I ended up using the following to copy a bunch of stuff but exclude the proper folders:
!**/+(x86|x64|obj|packages|.git)/**
The trick for me was to put the negative operator at the beginning of the row, then use the +
operator next to the list.
Thank you for your help!
Also, this codepen helped me figure it out: https://codepen.io/mrmlnc/pen/OXQjMe
Required Information
Entering this information will route you directly to the right team and expedite traction.
Question, Bug, or Feature?
Type: Bug
Enter Task Name: CopyFiles
Environment
Azure Pipelines, hosted agent, Hosted Ubuntu 16.04 pool
Issue Description
Given this task input:
I expect all files except the contents of
node_modules
and.git
to be copied. Instead, all files are copied.Expanding the parenthetical myself results in correct behavior:
Task logs