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

internal/pathwatcher: Fix how paths to watch are determined #6277

Merged

Conversation

ashutosh-narkar
Copy link
Member

Currently if a fsnotify watcher is specified for a particular directory, we incorrectly also add it's parent directory to be monitored. This happens because the function that determines which paths are to be watched calls filepath.Dir on each of them to get their directory. This is the right thing to do for files as their parent directory gets watched, but when done on a directory especially for the top-level directory adds an incorrect directory to be watched. This changes attempts to fix that.

Currently if a fsnotify watcher is specified for a particular
directory, we incorrectly also add it's parent directory to
be monitored. This happens because the function that determines
which paths are to be watched calls `filepath.Dir` on each of them
to get their directory. This is the right thing to do for files
as their parent directory gets watched, but when done on a directory
especially for the top-level directory adds an incorrect directory
to be watched. This changes attempts to fix that.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ashutosh-narkar ashutosh-narkar merged commit 0d675ca into open-policy-agent:main Oct 6, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants