{"action":"created","issue":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/1185","labels_url":"https://api.github.com/repos/syncthing/syncthing/issues/1185/labels{/name}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/1185/comments","events_url":"https://api.github.com/repos/syncthing/syncthing/issues/1185/events","html_url":"https://github.com/syncthing/syncthing/issues/1185","id":53500022,"number":1185,"title":"Ignore exclusion not good enough","user":{"login":"AudriusButkevicius","id":1144861,"avatar_url":"https://avatars.githubusercontent.com/u/1144861?v=3","gravatar_id":"","url":"https://api.github.com/users/AudriusButkevicius","html_url":"https://github.com/AudriusButkevicius","followers_url":"https://api.github.com/users/AudriusButkevicius/followers","following_url":"https://api.github.com/users/AudriusButkevicius/following{/other_user}","gists_url":"https://api.github.com/users/AudriusButkevicius/gists{/gist_id}","starred_url":"https://api.github.com/users/AudriusButkevicius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudriusButkevicius/subscriptions","organizations_url":"https://api.github.com/users/AudriusButkevicius/orgs","repos_url":"https://api.github.com/users/AudriusButkevicius/repos","events_url":"https://api.github.com/users/AudriusButkevicius/events{/privacy}","received_events_url":"https://api.github.com/users/AudriusButkevicius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/syncthing/syncthing/labels/enhancement","name":"enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/syncthing/syncthing/milestones/2","labels_url":"https://api.github.com/repos/syncthing/syncthing/milestones/2/labels","id":528782,"number":2,"title":"v1.0","description":"The big one.","creator":{"login":"calmh","id":125426,"avatar_url":"https://avatars.githubusercontent.com/u/125426?v=3","gravatar_id":"","url":"https://api.github.com/users/calmh","html_url":"https://github.com/calmh","followers_url":"https://api.github.com/users/calmh/followers","following_url":"https://api.github.com/users/calmh/following{/other_user}","gists_url":"https://api.github.com/users/calmh/gists{/gist_id}","starred_url":"https://api.github.com/users/calmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calmh/subscriptions","organizations_url":"https://api.github.com/users/calmh/orgs","repos_url":"https://api.github.com/users/calmh/repos","events_url":"https://api.github.com/users/calmh/events{/privacy}","received_events_url":"https://api.github.com/users/calmh/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":71,"state":"open","created_at":"2014-01-07T11:09:27Z","updated_at":"2015-01-06T10:13:51Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-01-06T10:13:51Z","updated_at":"2015-01-07T10:21:52Z","closed_at":null,"body":"```\r\n!/some/deep/directory/with/a/file\r\n*\r\n```\r\nDoes not work.\r\nThat is fixable by excluding every directory up to the target.\r\nBut these arent:\r\n```\r\n!unachored/deep/exclude\r\n*\r\n```\r\nor\r\n```\r\n!/some/deep/**/wildcard/exclude\r\n*\r\n```\r\n\r\nSee:\r\nhttps://discourse.syncthing.net/t/un-ignore-subfolders-files-of-ignored-folder/1460/6 \r\nand discussion:\r\nhttps://github.com/syncthing/syncthing/pull/1168\r\n\r\nAlso, currently we SkipDir in the walker if the directory matches an ignore, but we shouldn't as there might be some excludes down there."},"comment":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/comments/69003183","html_url":"https://github.com/syncthing/syncthing/issues/1185#issuecomment-69003183","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/1185","id":69003183,"user":{"login":"AudriusButkevicius","id":1144861,"avatar_url":"https://avatars.githubusercontent.com/u/1144861?v=3","gravatar_id":"","url":"https://api.github.com/users/AudriusButkevicius","html_url":"https://github.com/AudriusButkevicius","followers_url":"https://api.github.com/users/AudriusButkevicius/followers","following_url":"https://api.github.com/users/AudriusButkevicius/following{/other_user}","gists_url":"https://api.github.com/users/AudriusButkevicius/gists{/gist_id}","starred_url":"https://api.github.com/users/AudriusButkevicius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudriusButkevicius/subscriptions","organizations_url":"https://api.github.com/users/AudriusButkevicius/orgs","repos_url":"https://api.github.com/users/AudriusButkevicius/repos","events_url":"https://api.github.com/users/AudriusButkevicius/events{/privacy}","received_events_url":"https://api.github.com/users/AudriusButkevicius/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T10:21:52Z","updated_at":"2015-01-07T10:21:52Z","body":"I had an idea yesterday.\r\n\r\nIf we never skip dir, and we manage to match something to an exclude pattern, we can use matchers cache to check if the parent directories have been ignored or not.\r\nIf they have, we could forcefully mark them as unignored in the cache, and rewalk them one directory at a time (cd ..) until we reach the part which is not ignored anymore.\r\n\r\nIf ignore cache is disabled it's a bit harder, as we most likely won't know the outcome whether or not parent directories were ignored or not, so we'd have to have some special exclusion list which we populate going one directory up at a time which would force the matcher to exclude given directories from ignores, and then rescan those paths (and those paths only) causing parent directories to be indexed.\r\n\r\nPossible fix for making the decision of whether or not we should SkipDir could be done by the matcher under the following conditions:\r\n1. If we have an unachored exclude, never skip dir.\r\n2. If we have a double wildcard exclude, do not skip if the directory we are currently at matches the prefix of the exclude (up to the wildcard). \r\n3. For a single wildcard, something like 2, but a bit more clever where we only traverse one level.\r\n\r\nAlternatively, we could do this double walk thing, where we establish what we are going to walk first, and then walk it.\r\nThis would also allow us to deduce scan percentage."}}