Skip to content

Commit

Permalink
Fixes #10966: Ensure all subdirectory files are watched
Browse files Browse the repository at this point in the history
Prior to this commit, due to a fix that ignored `.vagrant` with rsync
helper, it broke the ability to watch for changes in subdirectories when
running the rsync-auto command. This commit puts back some of the helper
methods that were there previously for a given watcher path to ensure
that all files and subdirectories are properly watched and synced.
  • Loading branch information
briancain committed Sep 26, 2019
1 parent b3462d8 commit 1c62085
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions plugins/synced_folders/rsync/helper.rb
Expand Up @@ -30,6 +30,10 @@ def self.exclude_to_regexp(exclude)
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|||")
Expand Down
8 changes: 4 additions & 4 deletions test/unit/plugins/synced_folders/rsync/helper_test.rb
Expand Up @@ -33,22 +33,22 @@

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

Expand Down

0 comments on commit 1c62085

Please sign in to comment.