{"action":"created","comment":{"url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/comments/213759795","pull_request_review_id":150662667,"id":213759795,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzc1OTc5NQ==","diff_hunk":"@@ -113,6 +112,119 @@ public void validateJdkDirectoryWatcher() throws Exception {\n     runWatcher(directory.toPath(), FileSystems.getDefault().newWatchService());\n   }\n \n+  @Test\n+  public void supportFileWatchingOnFiles() throws Exception {\n+    File directory = new File(new File(\"\").getAbsolutePath(), \"target/directory\");\n+    FileUtils.deleteDirectory(directory);\n+    directory.mkdirs();\n+    Path directoryPath = directory.toPath();\n+    WatchService watchService = FileSystems.getDefault().newWatchService();\n+\n+    int waitInMs = 500;\n+    FileSystem fileSystem = new FileSystem(directoryPath)","path":"core/src/test/java/io/methvin/watchservice/DirectoryWatcherTest.java","position":61,"original_position":61,"commit_id":"34607127680ffe421351038cfb0fcda30953280b","original_commit_id":"34607127680ffe421351038cfb0fcda30953280b","user":{"login":"jvican","id":2462974,"node_id":"MDQ6VXNlcjI0NjI5NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2462974?v=4","gravatar_id":"","url":"https://api.github.com/users/jvican","html_url":"https://github.com/jvican","followers_url":"https://api.github.com/users/jvican/followers","following_url":"https://api.github.com/users/jvican/following{/other_user}","gists_url":"https://api.github.com/users/jvican/gists{/gist_id}","starred_url":"https://api.github.com/users/jvican/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvican/subscriptions","organizations_url":"https://api.github.com/users/jvican/orgs","repos_url":"https://api.github.com/users/jvican/repos","events_url":"https://api.github.com/users/jvican/events{/privacy}","received_events_url":"https://api.github.com/users/jvican/received_events","type":"User","site_admin":false},"body":"Let's see if Travis's Xcode instance likes this test, but I don't know why it doesn't seem to pass in my Mac OS High Sierra.","created_at":"2018-08-29T17:05:53Z","updated_at":"2018-08-29T17:06:04Z","html_url":"https://github.com/gmethvin/directory-watcher/pull/20#discussion_r213759795","pull_request_url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/comments/213759795"},"html":{"href":"https://github.com/gmethvin/directory-watcher/pull/20#discussion_r213759795"},"pull_request":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20","id":211823925,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExODIzOTI1","html_url":"https://github.com/gmethvin/directory-watcher/pull/20","diff_url":"https://github.com/gmethvin/directory-watcher/pull/20.diff","patch_url":"https://github.com/gmethvin/directory-watcher/pull/20.patch","issue_url":"https://api.github.com/repos/gmethvin/directory-watcher/issues/20","number":20,"state":"open","locked":false,"title":"Support watching independent files","user":{"login":"jvican","id":2462974,"node_id":"MDQ6VXNlcjI0NjI5NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2462974?v=4","gravatar_id":"","url":"https://api.github.com/users/jvican","html_url":"https://github.com/jvican","followers_url":"https://api.github.com/users/jvican/followers","following_url":"https://api.github.com/users/jvican/following{/other_user}","gists_url":"https://api.github.com/users/jvican/gists{/gist_id}","starred_url":"https://api.github.com/users/jvican/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvican/subscriptions","organizations_url":"https://api.github.com/users/jvican/orgs","repos_url":"https://api.github.com/users/jvican/repos","events_url":"https://api.github.com/users/jvican/events{/privacy}","received_events_url":"https://api.github.com/users/jvican/received_events","type":"User","site_admin":false},"body":"As explained in the docs, JDK's watch service cannot watch independent\nfiles and instead can only watch directories. To simulate watching\nindependent files, we watch their parent directories in a non-recursive\nmanner. This PR implements the bits to simulate this behaviour.\n\nThe strategy here is to first register all the paths that are\nnon-recursive, and then proceed to the recursive ones. If any of the\ndirectories that must be watched non-recursively are subsumed by any of the\nrecursive directories, they automatically become recursive.\n\nAll events about directories contained in non-recursive directories are\nignored by default.","created_at":"2018-08-29T17:03:49Z","updated_at":"2018-08-29T17:06:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b47605decb4a1ecd088c25bc25c23f5f91d0935c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20/commits","review_comments_url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20/comments","review_comment_url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gmethvin/directory-watcher/issues/20/comments","statuses_url":"https://api.github.com/repos/gmethvin/directory-watcher/statuses/34607127680ffe421351038cfb0fcda30953280b","head":{"label":"jvican:topic/watch-independent-files","ref":"topic/watch-independent-files","sha":"34607127680ffe421351038cfb0fcda30953280b","user":{"login":"jvican","id":2462974,"node_id":"MDQ6VXNlcjI0NjI5NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2462974?v=4","gravatar_id":"","url":"https://api.github.com/users/jvican","html_url":"https://github.com/jvican","followers_url":"https://api.github.com/users/jvican/followers","following_url":"https://api.github.com/users/jvican/following{/other_user}","gists_url":"https://api.github.com/users/jvican/gists{/gist_id}","starred_url":"https://api.github.com/users/jvican/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvican/subscriptions","organizations_url":"https://api.github.com/users/jvican/orgs","repos_url":"https://api.github.com/users/jvican/repos","events_url":"https://api.github.com/users/jvican/events{/privacy}","received_events_url":"https://api.github.com/users/jvican/received_events","type":"User","site_admin":false},"repo":{"id":129002112,"node_id":"MDEwOlJlcG9zaXRvcnkxMjkwMDIxMTI=","name":"directory-watcher","full_name":"jvican/directory-watcher","owner":{"login":"jvican","id":2462974,"node_id":"MDQ6VXNlcjI0NjI5NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2462974?v=4","gravatar_id":"","url":"https://api.github.com/users/jvican","html_url":"https://github.com/jvican","followers_url":"https://api.github.com/users/jvican/followers","following_url":"https://api.github.com/users/jvican/following{/other_user}","gists_url":"https://api.github.com/users/jvican/gists{/gist_id}","starred_url":"https://api.github.com/users/jvican/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvican/subscriptions","organizations_url":"https://api.github.com/users/jvican/orgs","repos_url":"https://api.github.com/users/jvican/repos","events_url":"https://api.github.com/users/jvican/events{/privacy}","received_events_url":"https://api.github.com/users/jvican/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jvican/directory-watcher","description":"A cross-platform Java recursive directory watcher, with a JNA macOS watcher and Scala better-files integration","fork":true,"url":"https://api.github.com/repos/jvican/directory-watcher","forks_url":"https://api.github.com/repos/jvican/directory-watcher/forks","keys_url":"https://api.github.com/repos/jvican/directory-watcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jvican/directory-watcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jvican/directory-watcher/teams","hooks_url":"https://api.github.com/repos/jvican/directory-watcher/hooks","issue_events_url":"https://api.github.com/repos/jvican/directory-watcher/issues/events{/number}","events_url":"https://api.github.com/repos/jvican/directory-watcher/events","assignees_url":"https://api.github.com/repos/jvican/directory-watcher/assignees{/user}","branches_url":"https://api.github.com/repos/jvican/directory-watcher/branches{/branch}","tags_url":"https://api.github.com/repos/jvican/directory-watcher/tags","blobs_url":"https://api.github.com/repos/jvican/directory-watcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jvican/directory-watcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jvican/directory-watcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/jvican/directory-watcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jvican/directory-watcher/statuses/{sha}","languages_url":"https://api.github.com/repos/jvican/directory-watcher/languages","stargazers_url":"https://api.github.com/repos/jvican/directory-watcher/stargazers","contributors_url":"https://api.github.com/repos/jvican/directory-watcher/contributors","subscribers_url":"https://api.github.com/repos/jvican/directory-watcher/subscribers","subscription_url":"https://api.github.com/repos/jvican/directory-watcher/subscription","commits_url":"https://api.github.com/repos/jvican/directory-watcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/jvican/directory-watcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/jvican/directory-watcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/jvican/directory-watcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/jvican/directory-watcher/contents/{+path}","compare_url":"https://api.github.com/repos/jvican/directory-watcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jvican/directory-watcher/merges","archive_url":"https://api.github.com/repos/jvican/directory-watcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jvican/directory-watcher/downloads","issues_url":"https://api.github.com/repos/jvican/directory-watcher/issues{/number}","pulls_url":"https://api.github.com/repos/jvican/directory-watcher/pulls{/number}","milestones_url":"https://api.github.com/repos/jvican/directory-watcher/milestones{/number}","notifications_url":"https://api.github.com/repos/jvican/directory-watcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jvican/directory-watcher/labels{/name}","releases_url":"https://api.github.com/repos/jvican/directory-watcher/releases{/id}","deployments_url":"https://api.github.com/repos/jvican/directory-watcher/deployments","created_at":"2018-04-10T22:27:25Z","updated_at":"2018-08-08T14:05:27Z","pushed_at":"2018-08-29T17:03:34Z","git_url":"git://github.com/jvican/directory-watcher.git","ssh_url":"git@github.com:jvican/directory-watcher.git","clone_url":"https://github.com/jvican/directory-watcher.git","svn_url":"https://github.com/jvican/directory-watcher","homepage":"","size":171,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gmethvin:master","ref":"master","sha":"c86047e31ed716003cab9afc79b4a5dd7c663f3c","user":{"login":"gmethvin","id":171663,"node_id":"MDQ6VXNlcjE3MTY2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/171663?v=4","gravatar_id":"","url":"https://api.github.com/users/gmethvin","html_url":"https://github.com/gmethvin","followers_url":"https://api.github.com/users/gmethvin/followers","following_url":"https://api.github.com/users/gmethvin/following{/other_user}","gists_url":"https://api.github.com/users/gmethvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gmethvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmethvin/subscriptions","organizations_url":"https://api.github.com/users/gmethvin/orgs","repos_url":"https://api.github.com/users/gmethvin/repos","events_url":"https://api.github.com/users/gmethvin/events{/privacy}","received_events_url":"https://api.github.com/users/gmethvin/received_events","type":"User","site_admin":false},"repo":{"id":101602191,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE2MDIxOTE=","name":"directory-watcher","full_name":"gmethvin/directory-watcher","owner":{"login":"gmethvin","id":171663,"node_id":"MDQ6VXNlcjE3MTY2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/171663?v=4","gravatar_id":"","url":"https://api.github.com/users/gmethvin","html_url":"https://github.com/gmethvin","followers_url":"https://api.github.com/users/gmethvin/followers","following_url":"https://api.github.com/users/gmethvin/following{/other_user}","gists_url":"https://api.github.com/users/gmethvin/gists{/gist_id}","starred_url":"https://api.github.com/users/gmethvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmethvin/subscriptions","organizations_url":"https://api.github.com/users/gmethvin/orgs","repos_url":"https://api.github.com/users/gmethvin/repos","events_url":"https://api.github.com/users/gmethvin/events{/privacy}","received_events_url":"https://api.github.com/users/gmethvin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gmethvin/directory-watcher","description":"A cross-platform Java recursive directory watcher, with a JNA macOS watcher and Scala better-files integration","fork":false,"url":"https://api.github.com/repos/gmethvin/directory-watcher","forks_url":"https://api.github.com/repos/gmethvin/directory-watcher/forks","keys_url":"https://api.github.com/repos/gmethvin/directory-watcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gmethvin/directory-watcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gmethvin/directory-watcher/teams","hooks_url":"https://api.github.com/repos/gmethvin/directory-watcher/hooks","issue_events_url":"https://api.github.com/repos/gmethvin/directory-watcher/issues/events{/number}","events_url":"https://api.github.com/repos/gmethvin/directory-watcher/events","assignees_url":"https://api.github.com/repos/gmethvin/directory-watcher/assignees{/user}","branches_url":"https://api.github.com/repos/gmethvin/directory-watcher/branches{/branch}","tags_url":"https://api.github.com/repos/gmethvin/directory-watcher/tags","blobs_url":"https://api.github.com/repos/gmethvin/directory-watcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gmethvin/directory-watcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gmethvin/directory-watcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/gmethvin/directory-watcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gmethvin/directory-watcher/statuses/{sha}","languages_url":"https://api.github.com/repos/gmethvin/directory-watcher/languages","stargazers_url":"https://api.github.com/repos/gmethvin/directory-watcher/stargazers","contributors_url":"https://api.github.com/repos/gmethvin/directory-watcher/contributors","subscribers_url":"https://api.github.com/repos/gmethvin/directory-watcher/subscribers","subscription_url":"https://api.github.com/repos/gmethvin/directory-watcher/subscription","commits_url":"https://api.github.com/repos/gmethvin/directory-watcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/gmethvin/directory-watcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/gmethvin/directory-watcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/gmethvin/directory-watcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/gmethvin/directory-watcher/contents/{+path}","compare_url":"https://api.github.com/repos/gmethvin/directory-watcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gmethvin/directory-watcher/merges","archive_url":"https://api.github.com/repos/gmethvin/directory-watcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gmethvin/directory-watcher/downloads","issues_url":"https://api.github.com/repos/gmethvin/directory-watcher/issues{/number}","pulls_url":"https://api.github.com/repos/gmethvin/directory-watcher/pulls{/number}","milestones_url":"https://api.github.com/repos/gmethvin/directory-watcher/milestones{/number}","notifications_url":"https://api.github.com/repos/gmethvin/directory-watcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gmethvin/directory-watcher/labels{/name}","releases_url":"https://api.github.com/repos/gmethvin/directory-watcher/releases{/id}","deployments_url":"https://api.github.com/repos/gmethvin/directory-watcher/deployments","created_at":"2017-08-28T03:54:21Z","updated_at":"2018-08-22T23:01:14Z","pushed_at":"2018-08-29T17:03:50Z","git_url":"git://github.com/gmethvin/directory-watcher.git","ssh_url":"git@github.com:gmethvin/directory-watcher.git","clone_url":"https://github.com/gmethvin/directory-watcher.git","svn_url":"https://github.com/gmethvin/directory-watcher","homepage":"","size":167,"stargazers_count":34,"watchers_count":34,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":9,"open_issues":5,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20"},"html":{"href":"https://github.com/gmethvin/directory-watcher/pull/20"},"issue":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/issues/20"},"comments":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/gmethvin/directory-watcher/statuses/34607127680ffe421351038cfb0fcda30953280b"}},"author_association":"NONE"}}
{"actor":{"display_login":"jvican"}}