{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/28689379","id":28689379,"diff_hunk":"@@ -382,6 +382,56 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L\n \treturn nil\n }\n \n+// Matches returns true if relFilePath matches any of the patterns\n+// and isn't excluded by any of the subsequent patterns.\n+func Matches(relFilePath string, patterns []string) (bool, error) {\n+\n+\tif filepath.Clean(relFilePath) == \".\" {\n+\t\t// Don't let them exclude everything, kind of silly.\n+\t\treturn false, nil\n+\t}\n+\n+\tmatched := false\n+\tparentPath := filepath.Dir(relFilePath)\n+\tparentPathDirs := strings.Split(parentPath, \"/\")\n+\n+\tfor _, pattern := range patterns {\n+\t\tnegative := false\n+\t\tif fileutils.Empty(pattern) {","path":"pkg/archive/archive.go","position":null,"original_position":19,"commit_id":"6bf8e2ad0c16a9e063450fa86d89a2e381eecf3f","original_commit_id":"2f3fa23ff68b1595e19995657162b76f6cb6a63f","user":{"login":"buddhamagnet","id":35007,"avatar_url":"https://avatars.githubusercontent.com/u/35007?v=3","gravatar_id":"","url":"https://api.github.com/users/buddhamagnet","html_url":"https://github.com/buddhamagnet","followers_url":"https://api.github.com/users/buddhamagnet/followers","following_url":"https://api.github.com/users/buddhamagnet/following{/other_user}","gists_url":"https://api.github.com/users/buddhamagnet/gists{/gist_id}","starred_url":"https://api.github.com/users/buddhamagnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buddhamagnet/subscriptions","organizations_url":"https://api.github.com/users/buddhamagnet/orgs","repos_url":"https://api.github.com/users/buddhamagnet/repos","events_url":"https://api.github.com/users/buddhamagnet/events{/privacy}","received_events_url":"https://api.github.com/users/buddhamagnet/received_events","type":"User","site_admin":false},"body":"@duglin removing empty patterns, but I can't do any more on this today, sorry.","created_at":"2015-04-20T13:47:57Z","updated_at":"2015-04-20T13:47:57Z","html_url":"https://github.com/docker/docker/pull/12245#discussion_r28689379","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/12245","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/28689379"},"html":{"href":"https://github.com/docker/docker/pull/12245#discussion_r28689379"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/12245"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/12245","id":32986187,"html_url":"https://github.com/docker/docker/pull/12245","diff_url":"https://github.com/docker/docker/pull/12245.diff","patch_url":"https://github.com/docker/docker/pull/12245.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/12245","number":12245,"state":"open","locked":false,"title":"Add support for exclusion rules in dockerignore","user":{"login":"buddhamagnet","id":35007,"avatar_url":"https://avatars.githubusercontent.com/u/35007?v=3","gravatar_id":"","url":"https://api.github.com/users/buddhamagnet","html_url":"https://github.com/buddhamagnet","followers_url":"https://api.github.com/users/buddhamagnet/followers","following_url":"https://api.github.com/users/buddhamagnet/following{/other_user}","gists_url":"https://api.github.com/users/buddhamagnet/gists{/gist_id}","starred_url":"https://api.github.com/users/buddhamagnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buddhamagnet/subscriptions","organizations_url":"https://api.github.com/users/buddhamagnet/orgs","repos_url":"https://api.github.com/users/buddhamagnet/repos","events_url":"https://api.github.com/users/buddhamagnet/events{/privacy}","received_events_url":"https://api.github.com/users/buddhamagnet/received_events","type":"User","site_admin":false},"body":"Parallel pull request to https://github.com/docker/docker/pull/11823.","created_at":"2015-04-09T19:08:04Z","updated_at":"2015-04-20T13:47:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74970e74d993a39264cff9865e73405d79759338","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/12245/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/12245/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/12245/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/6bf8e2ad0c16a9e063450fa86d89a2e381eecf3f","head":{"label":"buddhamagnet:dockerignore-ignores","ref":"dockerignore-ignores","sha":"6bf8e2ad0c16a9e063450fa86d89a2e381eecf3f","user":{"login":"buddhamagnet","id":35007,"avatar_url":"https://avatars.githubusercontent.com/u/35007?v=3","gravatar_id":"","url":"https://api.github.com/users/buddhamagnet","html_url":"https://github.com/buddhamagnet","followers_url":"https://api.github.com/users/buddhamagnet/followers","following_url":"https://api.github.com/users/buddhamagnet/following{/other_user}","gists_url":"https://api.github.com/users/buddhamagnet/gists{/gist_id}","starred_url":"https://api.github.com/users/buddhamagnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buddhamagnet/subscriptions","organizations_url":"https://api.github.com/users/buddhamagnet/orgs","repos_url":"https://api.github.com/users/buddhamagnet/repos","events_url":"https://api.github.com/users/buddhamagnet/events{/privacy}","received_events_url":"https://api.github.com/users/buddhamagnet/received_events","type":"User","site_admin":false},"repo":{"id":32522798,"name":"docker","full_name":"buddhamagnet/docker","owner":{"login":"buddhamagnet","id":35007,"avatar_url":"https://avatars.githubusercontent.com/u/35007?v=3","gravatar_id":"","url":"https://api.github.com/users/buddhamagnet","html_url":"https://github.com/buddhamagnet","followers_url":"https://api.github.com/users/buddhamagnet/followers","following_url":"https://api.github.com/users/buddhamagnet/following{/other_user}","gists_url":"https://api.github.com/users/buddhamagnet/gists{/gist_id}","starred_url":"https://api.github.com/users/buddhamagnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buddhamagnet/subscriptions","organizations_url":"https://api.github.com/users/buddhamagnet/orgs","repos_url":"https://api.github.com/users/buddhamagnet/repos","events_url":"https://api.github.com/users/buddhamagnet/events{/privacy}","received_events_url":"https://api.github.com/users/buddhamagnet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/buddhamagnet/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/buddhamagnet/docker","forks_url":"https://api.github.com/repos/buddhamagnet/docker/forks","keys_url":"https://api.github.com/repos/buddhamagnet/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/buddhamagnet/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/buddhamagnet/docker/teams","hooks_url":"https://api.github.com/repos/buddhamagnet/docker/hooks","issue_events_url":"https://api.github.com/repos/buddhamagnet/docker/issues/events{/number}","events_url":"https://api.github.com/repos/buddhamagnet/docker/events","assignees_url":"https://api.github.com/repos/buddhamagnet/docker/assignees{/user}","branches_url":"https://api.github.com/repos/buddhamagnet/docker/branches{/branch}","tags_url":"https://api.github.com/repos/buddhamagnet/docker/tags","blobs_url":"https://api.github.com/repos/buddhamagnet/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/buddhamagnet/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/buddhamagnet/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/buddhamagnet/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/buddhamagnet/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/buddhamagnet/docker/languages","stargazers_url":"https://api.github.com/repos/buddhamagnet/docker/stargazers","contributors_url":"https://api.github.com/repos/buddhamagnet/docker/contributors","subscribers_url":"https://api.github.com/repos/buddhamagnet/docker/subscribers","subscription_url":"https://api.github.com/repos/buddhamagnet/docker/subscription","commits_url":"https://api.github.com/repos/buddhamagnet/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/buddhamagnet/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/buddhamagnet/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/buddhamagnet/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/buddhamagnet/docker/contents/{+path}","compare_url":"https://api.github.com/repos/buddhamagnet/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/buddhamagnet/docker/merges","archive_url":"https://api.github.com/repos/buddhamagnet/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/buddhamagnet/docker/downloads","issues_url":"https://api.github.com/repos/buddhamagnet/docker/issues{/number}","pulls_url":"https://api.github.com/repos/buddhamagnet/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/buddhamagnet/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/buddhamagnet/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/buddhamagnet/docker/labels{/name}","releases_url":"https://api.github.com/repos/buddhamagnet/docker/releases{/id}","created_at":"2015-03-19T13:26:22Z","updated_at":"2015-04-17T10:36:24Z","pushed_at":"2015-04-20T13:47:26Z","git_url":"git://github.com/buddhamagnet/docker.git","ssh_url":"git@github.com:buddhamagnet/docker.git","clone_url":"https://github.com/buddhamagnet/docker.git","svn_url":"https://github.com/buddhamagnet/docker","homepage":"http://www.docker.com","size":49571,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"docker:master","ref":"master","sha":"dacc0507f08b54b506f832e100a1e27e389508e7","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-04-20T13:42:18Z","pushed_at":"2015-04-20T13:47:30Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":182531,"stargazers_count":20999,"watchers_count":20999,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4827,"mirror_url":null,"open_issues_count":915,"forks":4827,"open_issues":915,"watchers":20999,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/12245"},"html":{"href":"https://github.com/docker/docker/pull/12245"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/12245"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/12245/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/12245/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/12245/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/6bf8e2ad0c16a9e063450fa86d89a2e381eecf3f"}}}}