Merge pull request #11089 from briancain/rsync-helper-regex-path-fix

Fixes #10966: Ensure all subdirectory files are watched
This commit is contained in:
Brian Cain 2019-10-02 12:47:04 -07:00 committed by GitHub
commit f92e1a1973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -30,6 +30,10 @@ module VagrantPlugins
exclude = exclude[1..-1]
end
exclude = "#{exclude}/" if !exclude.end_with?("/")
exclude = "^#{exclude}"
exclude += ".*" if !start_anchor
# This is not an ideal solution, but it's a start. We can improve and
# keep unit tests passing in the future.
exclude = exclude.gsub("**", "|||GLOBAL|||")

View File

@ -33,22 +33,22 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
it "converts a directory match" do
expect(described_class.exclude_to_regexp("foo/")).
to eq(/foo\//)
to eq(/^foo\/.[^\/]*/)
end
it "converts the start anchor" do
expect(described_class.exclude_to_regexp("/foo")).
to eq(/foo/)
to eq(/^foo\//)
end
it "converts the **" do
expect(described_class.exclude_to_regexp("fo**o")).
to eq(/fo.*o/)
to eq(/^fo.*o\/.[^\/]*/)
end
it "converts the *" do
expect(described_class.exclude_to_regexp("fo*o")).
to eq(/fo[^\/]*o/)
to eq(/^fo[^\/]*o\/.[^\/]*/)
end
end