{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/client/pulls/comments/83813014","pull_request_review_id":4630135,"id":83813014,"diff_hunk":"@@ -88,41 +64,47 @@ void FolderWatcherPrivate::inotifyRegisterPath(const QString& path)\n \n void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path)\n {\n-    int subdirs = 0;\n     qDebug() << \"(+) Watcher:\" << path;\n-\n-    QDir inPath(path);\n-    inotifyRegisterPath(inPath.absolutePath());\n-\n     const QStringList watchedFolders = _watches.values();\n+    int subdirs = addFolderRecursiveHelper(path, watchedFolders.toSet());\n+    if (subdirs >0) {\n+        qDebug() << \"    `-> and\" << subdirs << \"subdirectories\";\n+    }\n+}\n \n-    QStringList allSubfolders;\n-    if( !findFoldersBelow(QDir(path), allSubfolders)) {\n-        qDebug() << \"Could not traverse all sub folders\";\n+int FolderWatcherPrivate::addFolderRecursiveHelper(const QString &path, const QSet<QString> &watchedFolders)\n+{\n+    QDir dir(path);\n+    if( !(dir.exists() && dir.isReadable()) ) {\n+        qDebug() << \"Non existing path coming in: \" << dir.absolutePath();\n+        return 0;\n     }\n-    // qDebug() << \"currently watching \" << watchedFolders;\n-    QStringListIterator subfoldersIt(allSubfolders);\n-    while (subfoldersIt.hasNext()) {\n-        QString subfolder = subfoldersIt.next();\n-        // qDebug() << \"  (**) subfolder: \" << subfolder;\n-        QDir folder (subfolder);\n-        if (folder.exists() && !watchedFolders.contains(folder.absolutePath())) {\n-            subdirs++;\n-            if( _parent->pathIsIgnored(subfolder) ) {\n+    int subdirs = 1;\n+\n+    inotifyRegisterPath(dir.absolutePath());\n+\n+    QDir::Filters filter = QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks | QDir::Hidden;\n+    const QStringList pathes = dir.entryList(filter);\n+    for (auto constIterator = pathes.constBegin(); constIterator != pathes.constEnd(); ++constIterator) {\n+        const QString subfolder = path + QLatin1String(\"/\") + (*constIterator);\n+        QDir folder(subfolder);\n+        if (folder.exists() && !watchedFolders.contains(subfolder)) {\n+#ifndef OWNCLOUD_TEST // InotifyWatcherTest is not interested in ignored files and does not link against the folder\n+            if( _parent->_folder->syncEngine().excludedFiles().isExcluded(\n+                    subfolder, path, _parent->_folder->ignoreHiddenFiles())) {","path":"src/gui/folderwatcher_linux.cpp","position":88,"original_position":88,"commit_id":"3bb364980cf422287cba813f574fbebca59d9fef","original_commit_id":"3bb364980cf422287cba813f574fbebca59d9fef","user":{"login":"ckamm","id":833306,"avatar_url":"https://avatars.githubusercontent.com/u/833306?v=3","gravatar_id":"","url":"https://api.github.com/users/ckamm","html_url":"https://github.com/ckamm","followers_url":"https://api.github.com/users/ckamm/followers","following_url":"https://api.github.com/users/ckamm/following{/other_user}","gists_url":"https://api.github.com/users/ckamm/gists{/gist_id}","starred_url":"https://api.github.com/users/ckamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckamm/subscriptions","organizations_url":"https://api.github.com/users/ckamm/orgs","repos_url":"https://api.github.com/users/ckamm/repos","events_url":"https://api.github.com/users/ckamm/events{/privacy}","received_events_url":"https://api.github.com/users/ckamm/received_events","type":"User","site_admin":false},"body":"I think for correctness this must always pass in the full folder-relative path. (see other comment)","created_at":"2016-10-18T09:18:52Z","updated_at":"2016-10-18T09:18:52Z","html_url":"https://github.com/owncloud/client/pull/5245#discussion_r83813014","pull_request_url":"https://api.github.com/repos/owncloud/client/pulls/5245","_links":{"self":{"href":"https://api.github.com/repos/owncloud/client/pulls/comments/83813014"},"html":{"href":"https://github.com/owncloud/client/pull/5245#discussion_r83813014"},"pull_request":{"href":"https://api.github.com/repos/owncloud/client/pulls/5245"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/client/pulls/5245","id":89032525,"html_url":"https://github.com/owncloud/client/pull/5245","diff_url":"https://github.com/owncloud/client/pull/5245.diff","patch_url":"https://github.com/owncloud/client/pull/5245.patch","issue_url":"https://api.github.com/repos/owncloud/client/issues/5245","number":5245,"state":"open","locked":false,"title":"FolderWatcher (linux): optimize slotAddFolderRecursive","user":{"login":"ogoffart","id":959326,"avatar_url":"https://avatars.githubusercontent.com/u/959326?v=3","gravatar_id":"","url":"https://api.github.com/users/ogoffart","html_url":"https://github.com/ogoffart","followers_url":"https://api.github.com/users/ogoffart/followers","following_url":"https://api.github.com/users/ogoffart/following{/other_user}","gists_url":"https://api.github.com/users/ogoffart/gists{/gist_id}","starred_url":"https://api.github.com/users/ogoffart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogoffart/subscriptions","organizations_url":"https://api.github.com/users/ogoffart/orgs","repos_url":"https://api.github.com/users/ogoffart/repos","events_url":"https://api.github.com/users/ogoffart/events{/privacy}","received_events_url":"https://api.github.com/users/ogoffart/received_events","type":"User","site_admin":false},"body":"- Instead of putting all the pathes in a big QStringList and then process them,\r\n  do the processing as we iterate with QDirIterator\r\n\r\n- Since we know that the parent directory is not ignored, we can simplify the\r\n  ignore check by not checking the part before (i.e: we call\r\n  ExcludedFiles::isExcluded with the parent 'path' as base path) This is what\r\n  speeds up considerably the function.\r\n\r\nNote that the OWNCLOUD_TEST check is already there in FolderWatcher::pathIsIgnored\r\nso the behavior is not changed","created_at":"2016-10-12T14:59:57Z","updated_at":"2016-10-18T09:20:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10b5181aa861d01c1c68038092b0a0b1d2d6b0b6","assignee":{"login":"ckamm","id":833306,"avatar_url":"https://avatars.githubusercontent.com/u/833306?v=3","gravatar_id":"","url":"https://api.github.com/users/ckamm","html_url":"https://github.com/ckamm","followers_url":"https://api.github.com/users/ckamm/followers","following_url":"https://api.github.com/users/ckamm/following{/other_user}","gists_url":"https://api.github.com/users/ckamm/gists{/gist_id}","starred_url":"https://api.github.com/users/ckamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckamm/subscriptions","organizations_url":"https://api.github.com/users/ckamm/orgs","repos_url":"https://api.github.com/users/ckamm/repos","events_url":"https://api.github.com/users/ckamm/events{/privacy}","received_events_url":"https://api.github.com/users/ckamm/received_events","type":"User","site_admin":false},"assignees":[{"login":"ckamm","id":833306,"avatar_url":"https://avatars.githubusercontent.com/u/833306?v=3","gravatar_id":"","url":"https://api.github.com/users/ckamm","html_url":"https://github.com/ckamm","followers_url":"https://api.github.com/users/ckamm/followers","following_url":"https://api.github.com/users/ckamm/following{/other_user}","gists_url":"https://api.github.com/users/ckamm/gists{/gist_id}","starred_url":"https://api.github.com/users/ckamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckamm/subscriptions","organizations_url":"https://api.github.com/users/ckamm/orgs","repos_url":"https://api.github.com/users/ckamm/repos","events_url":"https://api.github.com/users/ckamm/events{/privacy}","received_events_url":"https://api.github.com/users/ckamm/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/owncloud/client/milestones/31","html_url":"https://github.com/owncloud/client/milestones/2.3.0","labels_url":"https://api.github.com/repos/owncloud/client/milestones/31/labels","id":1716523,"number":31,"title":"2.3.0","description":"","creator":{"login":"guruz","id":959327,"avatar_url":"https://avatars.githubusercontent.com/u/959327?v=3","gravatar_id":"","url":"https://api.github.com/users/guruz","html_url":"https://github.com/guruz","followers_url":"https://api.github.com/users/guruz/followers","following_url":"https://api.github.com/users/guruz/following{/other_user}","gists_url":"https://api.github.com/users/guruz/gists{/gist_id}","starred_url":"https://api.github.com/users/guruz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guruz/subscriptions","organizations_url":"https://api.github.com/users/guruz/orgs","repos_url":"https://api.github.com/users/guruz/repos","events_url":"https://api.github.com/users/guruz/events{/privacy}","received_events_url":"https://api.github.com/users/guruz/received_events","type":"User","site_admin":false},"open_issues":35,"closed_issues":84,"state":"open","created_at":"2016-04-19T08:55:00Z","updated_at":"2016-10-18T08:48:28Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/client/pulls/5245/commits","review_comments_url":"https://api.github.com/repos/owncloud/client/pulls/5245/comments","review_comment_url":"https://api.github.com/repos/owncloud/client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/owncloud/client/issues/5245/comments","statuses_url":"https://api.github.com/repos/owncloud/client/statuses/3bb364980cf422287cba813f574fbebca59d9fef","head":{"label":"owncloud:folderwatcher","ref":"folderwatcher","sha":"3bb364980cf422287cba813f574fbebca59d9fef","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550623,"name":"client","full_name":"owncloud/client","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/client","description":":computer: Desktop Syncing Client for ownCloud","fork":false,"url":"https://api.github.com/repos/owncloud/client","forks_url":"https://api.github.com/repos/owncloud/client/forks","keys_url":"https://api.github.com/repos/owncloud/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/client/teams","hooks_url":"https://api.github.com/repos/owncloud/client/hooks","issue_events_url":"https://api.github.com/repos/owncloud/client/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/client/events","assignees_url":"https://api.github.com/repos/owncloud/client/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/client/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/client/tags","blobs_url":"https://api.github.com/repos/owncloud/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/client/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/client/languages","stargazers_url":"https://api.github.com/repos/owncloud/client/stargazers","contributors_url":"https://api.github.com/repos/owncloud/client/contributors","subscribers_url":"https://api.github.com/repos/owncloud/client/subscribers","subscription_url":"https://api.github.com/repos/owncloud/client/subscription","commits_url":"https://api.github.com/repos/owncloud/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/client/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/client/merges","archive_url":"https://api.github.com/repos/owncloud/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/client/downloads","issues_url":"https://api.github.com/repos/owncloud/client/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/client/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/client/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/client/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/client/releases{/id}","deployments_url":"https://api.github.com/repos/owncloud/client/deployments","created_at":"2012-08-25T10:44:53Z","updated_at":"2016-10-18T06:20:26Z","pushed_at":"2016-10-18T09:15:40Z","git_url":"git://github.com/owncloud/client.git","ssh_url":"git@github.com:owncloud/client.git","clone_url":"https://github.com/owncloud/client.git","svn_url":"https://github.com/owncloud/client","homepage":"","size":157279,"stargazers_count":749,"watchers_count":749,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":410,"mirror_url":null,"open_issues_count":539,"forks":410,"open_issues":539,"watchers":749,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"fc7aaf792b26c22adaef6997bb18c58fe2c18f94","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550623,"name":"client","full_name":"owncloud/client","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/client","description":":computer: Desktop Syncing Client for ownCloud","fork":false,"url":"https://api.github.com/repos/owncloud/client","forks_url":"https://api.github.com/repos/owncloud/client/forks","keys_url":"https://api.github.com/repos/owncloud/client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/client/teams","hooks_url":"https://api.github.com/repos/owncloud/client/hooks","issue_events_url":"https://api.github.com/repos/owncloud/client/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/client/events","assignees_url":"https://api.github.com/repos/owncloud/client/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/client/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/client/tags","blobs_url":"https://api.github.com/repos/owncloud/client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/client/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/client/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/client/languages","stargazers_url":"https://api.github.com/repos/owncloud/client/stargazers","contributors_url":"https://api.github.com/repos/owncloud/client/contributors","subscribers_url":"https://api.github.com/repos/owncloud/client/subscribers","subscription_url":"https://api.github.com/repos/owncloud/client/subscription","commits_url":"https://api.github.com/repos/owncloud/client/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/client/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/client/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/client/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/client/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/client/merges","archive_url":"https://api.github.com/repos/owncloud/client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/client/downloads","issues_url":"https://api.github.com/repos/owncloud/client/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/client/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/client/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/client/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/client/releases{/id}","deployments_url":"https://api.github.com/repos/owncloud/client/deployments","created_at":"2012-08-25T10:44:53Z","updated_at":"2016-10-18T06:20:26Z","pushed_at":"2016-10-18T09:15:40Z","git_url":"git://github.com/owncloud/client.git","ssh_url":"git@github.com:owncloud/client.git","clone_url":"https://github.com/owncloud/client.git","svn_url":"https://github.com/owncloud/client","homepage":"","size":157279,"stargazers_count":749,"watchers_count":749,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":410,"mirror_url":null,"open_issues_count":539,"forks":410,"open_issues":539,"watchers":749,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/client/pulls/5245"},"html":{"href":"https://github.com/owncloud/client/pull/5245"},"issue":{"href":"https://api.github.com/repos/owncloud/client/issues/5245"},"comments":{"href":"https://api.github.com/repos/owncloud/client/issues/5245/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/client/pulls/5245/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/owncloud/client/pulls/5245/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/client/statuses/3bb364980cf422287cba813f574fbebca59d9fef"}}}}
{"actor":{"display_login":"ckamm"}}