{"action":"created","comment":{"url":"https://api.github.com/repos/Deewiant/glob/pulls/comments/136665379","pull_request_review_id":60242349,"id":136665379,"diff_hunk":"@@ -321,3 +321,16 @@ commonDirectory = second unseparate . splitP . separate\n    fromConst d (ExtSeparator   :xs) = fromConst (d `DL.snoc` extSeparator) xs\n    fromConst d (LongLiteral _ s:xs) = fromConst (d `DL.append`DL.fromList s) xs\n    fromConst _ _                    = Nothing\n+\n+   -- \".\" must be explicitly matched at the start of a pattern or after a path\n+   -- separator; this function checks for an implicit match i.e. \"[.]\".\n+   startsWithImplicitExt p =\n+      case unPattern p of\n+         (Literal '.' : _) ->\n+            True\n+         (LongLiteral _ l : _) ->\n+            case l of\n+               ('.':_) -> True\n+               _ -> False","path":"System/FilePath/Glob/Directory.hs","position":34,"original_position":23,"commit_id":"3cc25325c425d57c7135a0a4eec158d4473f1ce8","original_commit_id":"b35c4d79cd8d5fef4612e89ee1d72e41bbb8bc36","user":{"login":"hdgarrood","id":1270186,"avatar_url":"https://avatars2.githubusercontent.com/u/1270186?v=4","gravatar_id":"","url":"https://api.github.com/users/hdgarrood","html_url":"https://github.com/hdgarrood","followers_url":"https://api.github.com/users/hdgarrood/followers","following_url":"https://api.github.com/users/hdgarrood/following{/other_user}","gists_url":"https://api.github.com/users/hdgarrood/gists{/gist_id}","starred_url":"https://api.github.com/users/hdgarrood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdgarrood/subscriptions","organizations_url":"https://api.github.com/users/hdgarrood/orgs","repos_url":"https://api.github.com/users/hdgarrood/repos","events_url":"https://api.github.com/users/hdgarrood/events{/privacy}","received_events_url":"https://api.github.com/users/hdgarrood/received_events","type":"User","site_admin":false},"body":"I tried that to start with, but I don't think that will always work; consider:\r\n\r\n```haskell\r\n> compile \"[.]foo\" == Pattern [LongLiteral 4 \".foo\"]\r\nTrue\r\n```\r\n","created_at":"2017-09-01T21:05:39Z","updated_at":"2017-09-01T21:05:39Z","html_url":"https://github.com/Deewiant/glob/pull/19#discussion_r136665379","pull_request_url":"https://api.github.com/repos/Deewiant/glob/pulls/19","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Deewiant/glob/pulls/comments/136665379"},"html":{"href":"https://github.com/Deewiant/glob/pull/19#discussion_r136665379"},"pull_request":{"href":"https://api.github.com/repos/Deewiant/glob/pulls/19"}},"in_reply_to_id":136663684},"pull_request":{"url":"https://api.github.com/repos/Deewiant/glob/pulls/19","id":138916954,"html_url":"https://github.com/Deewiant/glob/pull/19","diff_url":"https://github.com/Deewiant/glob/pull/19.diff","patch_url":"https://github.com/Deewiant/glob/pull/19.patch","issue_url":"https://api.github.com/repos/Deewiant/glob/issues/19","number":19,"state":"open","locked":false,"title":"Fix `commonDirectory`, fixes #18","user":{"login":"hdgarrood","id":1270186,"avatar_url":"https://avatars2.githubusercontent.com/u/1270186?v=4","gravatar_id":"","url":"https://api.github.com/users/hdgarrood","html_url":"https://github.com/hdgarrood","followers_url":"https://api.github.com/users/hdgarrood/followers","following_url":"https://api.github.com/users/hdgarrood/following{/other_user}","gists_url":"https://api.github.com/users/hdgarrood/gists{/gist_id}","starred_url":"https://api.github.com/users/hdgarrood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdgarrood/subscriptions","organizations_url":"https://api.github.com/users/hdgarrood/orgs","repos_url":"https://api.github.com/users/hdgarrood/repos","events_url":"https://api.github.com/users/hdgarrood/events{/privacy}","received_events_url":"https://api.github.com/users/hdgarrood/received_events","type":"User","site_admin":false},"body":"I modified `unseparate` based on the following observations:\r\n\r\n- the `Int` argument to the `Dir` and `AnyDir` constructors specifies the number of path separators directly following the `Pattern`\r\n- however, the `AnyDirectory` token represents the string `**/` in a `Pattern`; therefore, we subtract 1 from the argument when unseparating. Otherwise, we end up with one too many separators.\r\n- similarly, I changed the behaviour of `f` so that it produces `n` path separators rather than `n+1` as it was before.\r\n\r\nThe `unseparate` function is used in one other place, in `matchTypedAndGo` when we encounter an `AnyDir` pattern. The current test suite still passes, but I'm not really sure if that's enough to conclude that I haven't accidentally broken it; do you have any thoughts on that?","created_at":"2017-09-01T15:30:23Z","updated_at":"2017-09-01T21:05:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36db0a8db99bbf088401bc70b9f0c54b2efa8816","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Deewiant/glob/pulls/19/commits","review_comments_url":"https://api.github.com/repos/Deewiant/glob/pulls/19/comments","review_comment_url":"https://api.github.com/repos/Deewiant/glob/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Deewiant/glob/issues/19/comments","statuses_url":"https://api.github.com/repos/Deewiant/glob/statuses/3cc25325c425d57c7135a0a4eec158d4473f1ce8","head":{"label":"hdgarrood:commonDirectory","ref":"commonDirectory","sha":"3cc25325c425d57c7135a0a4eec158d4473f1ce8","user":{"login":"hdgarrood","id":1270186,"avatar_url":"https://avatars2.githubusercontent.com/u/1270186?v=4","gravatar_id":"","url":"https://api.github.com/users/hdgarrood","html_url":"https://github.com/hdgarrood","followers_url":"https://api.github.com/users/hdgarrood/followers","following_url":"https://api.github.com/users/hdgarrood/following{/other_user}","gists_url":"https://api.github.com/users/hdgarrood/gists{/gist_id}","starred_url":"https://api.github.com/users/hdgarrood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdgarrood/subscriptions","organizations_url":"https://api.github.com/users/hdgarrood/orgs","repos_url":"https://api.github.com/users/hdgarrood/repos","events_url":"https://api.github.com/users/hdgarrood/events{/privacy}","received_events_url":"https://api.github.com/users/hdgarrood/received_events","type":"User","site_admin":false},"repo":{"id":101927889,"name":"glob","full_name":"hdgarrood/glob","owner":{"login":"hdgarrood","id":1270186,"avatar_url":"https://avatars2.githubusercontent.com/u/1270186?v=4","gravatar_id":"","url":"https://api.github.com/users/hdgarrood","html_url":"https://github.com/hdgarrood","followers_url":"https://api.github.com/users/hdgarrood/followers","following_url":"https://api.github.com/users/hdgarrood/following{/other_user}","gists_url":"https://api.github.com/users/hdgarrood/gists{/gist_id}","starred_url":"https://api.github.com/users/hdgarrood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdgarrood/subscriptions","organizations_url":"https://api.github.com/users/hdgarrood/orgs","repos_url":"https://api.github.com/users/hdgarrood/repos","events_url":"https://api.github.com/users/hdgarrood/events{/privacy}","received_events_url":"https://api.github.com/users/hdgarrood/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hdgarrood/glob","description":"Haskell library for glob matching","fork":true,"url":"https://api.github.com/repos/hdgarrood/glob","forks_url":"https://api.github.com/repos/hdgarrood/glob/forks","keys_url":"https://api.github.com/repos/hdgarrood/glob/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hdgarrood/glob/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hdgarrood/glob/teams","hooks_url":"https://api.github.com/repos/hdgarrood/glob/hooks","issue_events_url":"https://api.github.com/repos/hdgarrood/glob/issues/events{/number}","events_url":"https://api.github.com/repos/hdgarrood/glob/events","assignees_url":"https://api.github.com/repos/hdgarrood/glob/assignees{/user}","branches_url":"https://api.github.com/repos/hdgarrood/glob/branches{/branch}","tags_url":"https://api.github.com/repos/hdgarrood/glob/tags","blobs_url":"https://api.github.com/repos/hdgarrood/glob/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hdgarrood/glob/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hdgarrood/glob/git/refs{/sha}","trees_url":"https://api.github.com/repos/hdgarrood/glob/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hdgarrood/glob/statuses/{sha}","languages_url":"https://api.github.com/repos/hdgarrood/glob/languages","stargazers_url":"https://api.github.com/repos/hdgarrood/glob/stargazers","contributors_url":"https://api.github.com/repos/hdgarrood/glob/contributors","subscribers_url":"https://api.github.com/repos/hdgarrood/glob/subscribers","subscription_url":"https://api.github.com/repos/hdgarrood/glob/subscription","commits_url":"https://api.github.com/repos/hdgarrood/glob/commits{/sha}","git_commits_url":"https://api.github.com/repos/hdgarrood/glob/git/commits{/sha}","comments_url":"https://api.github.com/repos/hdgarrood/glob/comments{/number}","issue_comment_url":"https://api.github.com/repos/hdgarrood/glob/issues/comments{/number}","contents_url":"https://api.github.com/repos/hdgarrood/glob/contents/{+path}","compare_url":"https://api.github.com/repos/hdgarrood/glob/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hdgarrood/glob/merges","archive_url":"https://api.github.com/repos/hdgarrood/glob/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hdgarrood/glob/downloads","issues_url":"https://api.github.com/repos/hdgarrood/glob/issues{/number}","pulls_url":"https://api.github.com/repos/hdgarrood/glob/pulls{/number}","milestones_url":"https://api.github.com/repos/hdgarrood/glob/milestones{/number}","notifications_url":"https://api.github.com/repos/hdgarrood/glob/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hdgarrood/glob/labels{/name}","releases_url":"https://api.github.com/repos/hdgarrood/glob/releases{/id}","deployments_url":"https://api.github.com/repos/hdgarrood/glob/deployments","created_at":"2017-08-30T20:54:37Z","updated_at":"2017-08-30T20:54:38Z","pushed_at":"2017-09-01T20:39:32Z","git_url":"git://github.com/hdgarrood/glob.git","ssh_url":"git@github.com:hdgarrood/glob.git","clone_url":"https://github.com/hdgarrood/glob.git","svn_url":"https://github.com/hdgarrood/glob","homepage":"https://deewiant.iki.fi/projects/glob/","size":196,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Deewiant:master","ref":"master","sha":"7697bd20960566b1d215c7095d1d1bf448b35f66","user":{"login":"Deewiant","id":445326,"avatar_url":"https://avatars3.githubusercontent.com/u/445326?v=4","gravatar_id":"","url":"https://api.github.com/users/Deewiant","html_url":"https://github.com/Deewiant","followers_url":"https://api.github.com/users/Deewiant/followers","following_url":"https://api.github.com/users/Deewiant/following{/other_user}","gists_url":"https://api.github.com/users/Deewiant/gists{/gist_id}","starred_url":"https://api.github.com/users/Deewiant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deewiant/subscriptions","organizations_url":"https://api.github.com/users/Deewiant/orgs","repos_url":"https://api.github.com/users/Deewiant/repos","events_url":"https://api.github.com/users/Deewiant/events{/privacy}","received_events_url":"https://api.github.com/users/Deewiant/received_events","type":"User","site_admin":false},"repo":{"id":29018278,"name":"glob","full_name":"Deewiant/glob","owner":{"login":"Deewiant","id":445326,"avatar_url":"https://avatars3.githubusercontent.com/u/445326?v=4","gravatar_id":"","url":"https://api.github.com/users/Deewiant","html_url":"https://github.com/Deewiant","followers_url":"https://api.github.com/users/Deewiant/followers","following_url":"https://api.github.com/users/Deewiant/following{/other_user}","gists_url":"https://api.github.com/users/Deewiant/gists{/gist_id}","starred_url":"https://api.github.com/users/Deewiant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deewiant/subscriptions","organizations_url":"https://api.github.com/users/Deewiant/orgs","repos_url":"https://api.github.com/users/Deewiant/repos","events_url":"https://api.github.com/users/Deewiant/events{/privacy}","received_events_url":"https://api.github.com/users/Deewiant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Deewiant/glob","description":"Haskell library for glob matching","fork":false,"url":"https://api.github.com/repos/Deewiant/glob","forks_url":"https://api.github.com/repos/Deewiant/glob/forks","keys_url":"https://api.github.com/repos/Deewiant/glob/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Deewiant/glob/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Deewiant/glob/teams","hooks_url":"https://api.github.com/repos/Deewiant/glob/hooks","issue_events_url":"https://api.github.com/repos/Deewiant/glob/issues/events{/number}","events_url":"https://api.github.com/repos/Deewiant/glob/events","assignees_url":"https://api.github.com/repos/Deewiant/glob/assignees{/user}","branches_url":"https://api.github.com/repos/Deewiant/glob/branches{/branch}","tags_url":"https://api.github.com/repos/Deewiant/glob/tags","blobs_url":"https://api.github.com/repos/Deewiant/glob/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Deewiant/glob/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Deewiant/glob/git/refs{/sha}","trees_url":"https://api.github.com/repos/Deewiant/glob/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Deewiant/glob/statuses/{sha}","languages_url":"https://api.github.com/repos/Deewiant/glob/languages","stargazers_url":"https://api.github.com/repos/Deewiant/glob/stargazers","contributors_url":"https://api.github.com/repos/Deewiant/glob/contributors","subscribers_url":"https://api.github.com/repos/Deewiant/glob/subscribers","subscription_url":"https://api.github.com/repos/Deewiant/glob/subscription","commits_url":"https://api.github.com/repos/Deewiant/glob/commits{/sha}","git_commits_url":"https://api.github.com/repos/Deewiant/glob/git/commits{/sha}","comments_url":"https://api.github.com/repos/Deewiant/glob/comments{/number}","issue_comment_url":"https://api.github.com/repos/Deewiant/glob/issues/comments{/number}","contents_url":"https://api.github.com/repos/Deewiant/glob/contents/{+path}","compare_url":"https://api.github.com/repos/Deewiant/glob/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Deewiant/glob/merges","archive_url":"https://api.github.com/repos/Deewiant/glob/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Deewiant/glob/downloads","issues_url":"https://api.github.com/repos/Deewiant/glob/issues{/number}","pulls_url":"https://api.github.com/repos/Deewiant/glob/pulls{/number}","milestones_url":"https://api.github.com/repos/Deewiant/glob/milestones{/number}","notifications_url":"https://api.github.com/repos/Deewiant/glob/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Deewiant/glob/labels{/name}","releases_url":"https://api.github.com/repos/Deewiant/glob/releases{/id}","deployments_url":"https://api.github.com/repos/Deewiant/glob/deployments","created_at":"2015-01-09T13:51:09Z","updated_at":"2017-05-12T14:20:29Z","pushed_at":"2017-09-01T20:39:33Z","git_url":"git://github.com/Deewiant/glob.git","ssh_url":"git@github.com:Deewiant/glob.git","clone_url":"https://github.com/Deewiant/glob.git","svn_url":"https://github.com/Deewiant/glob","homepage":"https://deewiant.iki.fi/projects/glob/","size":195,"stargazers_count":4,"watchers_count":4,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Deewiant/glob/pulls/19"},"html":{"href":"https://github.com/Deewiant/glob/pull/19"},"issue":{"href":"https://api.github.com/repos/Deewiant/glob/issues/19"},"comments":{"href":"https://api.github.com/repos/Deewiant/glob/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/Deewiant/glob/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/Deewiant/glob/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Deewiant/glob/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/Deewiant/glob/statuses/3cc25325c425d57c7135a0a4eec158d4473f1ce8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hdgarrood"}}