{"action":"created","comment":{"url":"https://api.github.com/repos/github/git-lfs/pulls/comments/35630556","id":35630556,"diff_hunk":"@@ -86,3 +88,64 @@ func wrapProgressError(err error, event, filename string) error {\n \n \treturn nil\n }\n+\n+// Return whether a given filename passes the include / exclude path filters\n+// Only paths that are in includePaths and outside excludePaths are passed\n+// If includePaths is empty that filter always passes and the same with excludePaths\n+// Both path lists support wildcard matches\n+func FilenamePassesIncludeExcludeFilter(filename string, includePaths, excludePaths []string) bool {\n+\tif len(includePaths) == 0 && len(excludePaths) == 0 {\n+\t\treturn true\n+\t}\n+\n+\t// For Win32, becuase git reports files with / separators\n+\tcleanfilename := filepath.Clean(filename)\n+\tif len(includePaths) > 0 {\n+\t\tmatched := false\n+\t\tfor _, inc := range includePaths {\n+\t\t\tmatched, _ = filepath.Match(inc, filename)\n+\t\t\tif !matched && IsWindows() {\n+\t\t\t\t// Also Win32 match\n+\t\t\t\tmatched, _ = filepath.Match(inc, cleanfilename)\n+\t\t\t}\n+\t\t\tif !matched {\n+\t\t\t\t// Also support matching a parent directory without a wildcard\n+\t\t\t\tif strings.HasPrefix(cleanfilename, inc+string(filepath.Separator)) {\n+\t\t\t\t\tmatched = true\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tif matched {\n+\t\t\t\tbreak\n+\t\t\t}\n+\n+\t\t}\n+\t\tif !matched {\n+\t\t\treturn false\n+\t\t}\n+\t}\n+\n+\tif len(excludePaths) > 0 {\n+\t\tfor _, ex := range excludePaths {\n+\t\t\tmatched, _ := filepath.Match(ex, filename)\n+\t\t\tif !matched && IsWindows() {\n+\t\t\t\t// Also Win32 match\n+\t\t\t\tmatched, _ = filepath.Match(ex, cleanfilename)\n+\t\t\t}\n+\t\t\tif matched {\n+\t\t\t\treturn false\n+\t\t\t}\n+\t\t\t// Also support matching a parent directory without a wildcard\n+\t\t\tif strings.HasPrefix(cleanfilename, ex+string(filepath.Separator)) {\n+\t\t\t\treturn false\n+\t\t\t}\n+\n+\t\t}\n+\t}\n+\n+\treturn true\n+}\n+\n+// Are we running on Windows? Need to handle some extra path shenanigans\n+func IsWindows() bool {\n+\treturn runtime.GOOS == \"windows\"","path":"lfs/util.go","position":72,"original_position":72,"commit_id":"9a793dd747219b4683b9a99f52f67fac7465977f","original_commit_id":"05de710bc16f7790a2615e823c0b757de3387a69","user":{"login":"sinbad","id":142735,"avatar_url":"https://avatars.githubusercontent.com/u/142735?v=3","gravatar_id":"","url":"https://api.github.com/users/sinbad","html_url":"https://github.com/sinbad","followers_url":"https://api.github.com/users/sinbad/followers","following_url":"https://api.github.com/users/sinbad/following{/other_user}","gists_url":"https://api.github.com/users/sinbad/gists{/gist_id}","starred_url":"https://api.github.com/users/sinbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinbad/subscriptions","organizations_url":"https://api.github.com/users/sinbad/orgs","repos_url":"https://api.github.com/users/sinbad/repos","events_url":"https://api.github.com/users/sinbad/events{/privacy}","received_events_url":"https://api.github.com/users/sinbad/received_events","type":"User","site_admin":false},"body":"OK will do, but FYI it's not expensive, will fail on the first byte.","created_at":"2015-07-28T09:43:36Z","updated_at":"2015-07-28T09:43:36Z","html_url":"https://github.com/github/git-lfs/pull/527#discussion_r35630556","pull_request_url":"https://api.github.com/repos/github/git-lfs/pulls/527","_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments/35630556"},"html":{"href":"https://github.com/github/git-lfs/pull/527#discussion_r35630556"},"pull_request":{"href":"https://api.github.com/repos/github/git-lfs/pulls/527"}}},"pull_request":{"url":"https://api.github.com/repos/github/git-lfs/pulls/527","id":40923325,"html_url":"https://github.com/github/git-lfs/pull/527","diff_url":"https://github.com/github/git-lfs/pull/527.diff","patch_url":"https://github.com/github/git-lfs/pull/527.patch","issue_url":"https://api.github.com/repos/github/git-lfs/issues/527","number":527,"state":"open","locked":false,"title":"Add checkout & pull commands, changes and fixes to fetch","user":{"login":"sinbad","id":142735,"avatar_url":"https://avatars.githubusercontent.com/u/142735?v=3","gravatar_id":"","url":"https://api.github.com/users/sinbad","html_url":"https://github.com/sinbad","followers_url":"https://api.github.com/users/sinbad/followers","following_url":"https://api.github.com/users/sinbad/following{/other_user}","gists_url":"https://api.github.com/users/sinbad/gists{/gist_id}","starred_url":"https://api.github.com/users/sinbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinbad/subscriptions","organizations_url":"https://api.github.com/users/sinbad/orgs","repos_url":"https://api.github.com/users/sinbad/repos","events_url":"https://api.github.com/users/sinbad/events{/privacy}","received_events_url":"https://api.github.com/users/sinbad/received_events","type":"User","site_admin":false},"body":"1. `fetch` no longer updates the working copy, it only downloads files\r\n2. Added `checkout` command which updates the working copy with content if files are missing or are matching pointers. Modified files are left alone (user should reset if they want)\r\n3. Added `pull` command which performs `fetch` and `checkout` for the current ref\r\n4. `fetch` now supports multiple refs as arguments\r\n5. `checkout` will correctly populate multiple local files with the same content (old `fetch` would only populate the first one returned from `git rev-list`)\r\n6. `fetch` only adds missing or incorrect objects to the download queue, not all of them. This improves the progress reporting; previously fetch would appear to be trying to download all objects referenced at a ref then only have to download the missing ones as the download queue figured out they were already local. Also means fetch reports nothing at all if you're completely up to date already, instead of reporting \"(0 of 1000 files)\".\r\n7. A side effect is that 'pull' does all fetching first, then all checkout (not interleaved as before). This is because there may be more objects to checkout than to fetch (missing in working copy but already in store). Coupling these has unwanted edge cases & it's better to simplify & do what it says on the tin i.e. the same as running fetch then checkout.\r\n\r\nNote that the ScanTree does something similar to ScanRefs but reports pointers for every file that uses the content and not just one where multiple files share the same content. I'm not sure if this is the intended behaviour elsewhere but for now I've left it as a separate method. It also doesn't have the race conditions on nameMap that I believe ScanRefs has (commented elsewhere).\r\n","created_at":"2015-07-27T16:39:18Z","updated_at":"2015-07-28T09:43:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a88c53f820872071687c83b79bde7813002877bf","assignee":{"login":"technoweenie","id":21,"avatar_url":"https://avatars.githubusercontent.com/u/21?v=3","gravatar_id":"","url":"https://api.github.com/users/technoweenie","html_url":"https://github.com/technoweenie","followers_url":"https://api.github.com/users/technoweenie/followers","following_url":"https://api.github.com/users/technoweenie/following{/other_user}","gists_url":"https://api.github.com/users/technoweenie/gists{/gist_id}","starred_url":"https://api.github.com/users/technoweenie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/technoweenie/subscriptions","organizations_url":"https://api.github.com/users/technoweenie/orgs","repos_url":"https://api.github.com/users/technoweenie/repos","events_url":"https://api.github.com/users/technoweenie/events{/privacy}","received_events_url":"https://api.github.com/users/technoweenie/received_events","type":"User","site_admin":true},"milestone":null,"commits_url":"https://api.github.com/repos/github/git-lfs/pulls/527/commits","review_comments_url":"https://api.github.com/repos/github/git-lfs/pulls/527/comments","review_comment_url":"https://api.github.com/repos/github/git-lfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/github/git-lfs/issues/527/comments","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/9a793dd747219b4683b9a99f52f67fac7465977f","head":{"label":"sinbad:fetch-pull-checkout","ref":"fetch-pull-checkout","sha":"9a793dd747219b4683b9a99f52f67fac7465977f","user":{"login":"sinbad","id":142735,"avatar_url":"https://avatars.githubusercontent.com/u/142735?v=3","gravatar_id":"","url":"https://api.github.com/users/sinbad","html_url":"https://github.com/sinbad","followers_url":"https://api.github.com/users/sinbad/followers","following_url":"https://api.github.com/users/sinbad/following{/other_user}","gists_url":"https://api.github.com/users/sinbad/gists{/gist_id}","starred_url":"https://api.github.com/users/sinbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinbad/subscriptions","organizations_url":"https://api.github.com/users/sinbad/orgs","repos_url":"https://api.github.com/users/sinbad/repos","events_url":"https://api.github.com/users/sinbad/events{/privacy}","received_events_url":"https://api.github.com/users/sinbad/received_events","type":"User","site_admin":false},"repo":{"id":35943098,"name":"git-lfs","full_name":"sinbad/git-lfs","owner":{"login":"sinbad","id":142735,"avatar_url":"https://avatars.githubusercontent.com/u/142735?v=3","gravatar_id":"","url":"https://api.github.com/users/sinbad","html_url":"https://github.com/sinbad","followers_url":"https://api.github.com/users/sinbad/followers","following_url":"https://api.github.com/users/sinbad/following{/other_user}","gists_url":"https://api.github.com/users/sinbad/gists{/gist_id}","starred_url":"https://api.github.com/users/sinbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinbad/subscriptions","organizations_url":"https://api.github.com/users/sinbad/orgs","repos_url":"https://api.github.com/users/sinbad/repos","events_url":"https://api.github.com/users/sinbad/events{/privacy}","received_events_url":"https://api.github.com/users/sinbad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sinbad/git-lfs","description":"Git extension for versioning large files","fork":true,"url":"https://api.github.com/repos/sinbad/git-lfs","forks_url":"https://api.github.com/repos/sinbad/git-lfs/forks","keys_url":"https://api.github.com/repos/sinbad/git-lfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sinbad/git-lfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sinbad/git-lfs/teams","hooks_url":"https://api.github.com/repos/sinbad/git-lfs/hooks","issue_events_url":"https://api.github.com/repos/sinbad/git-lfs/issues/events{/number}","events_url":"https://api.github.com/repos/sinbad/git-lfs/events","assignees_url":"https://api.github.com/repos/sinbad/git-lfs/assignees{/user}","branches_url":"https://api.github.com/repos/sinbad/git-lfs/branches{/branch}","tags_url":"https://api.github.com/repos/sinbad/git-lfs/tags","blobs_url":"https://api.github.com/repos/sinbad/git-lfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sinbad/git-lfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sinbad/git-lfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sinbad/git-lfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sinbad/git-lfs/statuses/{sha}","languages_url":"https://api.github.com/repos/sinbad/git-lfs/languages","stargazers_url":"https://api.github.com/repos/sinbad/git-lfs/stargazers","contributors_url":"https://api.github.com/repos/sinbad/git-lfs/contributors","subscribers_url":"https://api.github.com/repos/sinbad/git-lfs/subscribers","subscription_url":"https://api.github.com/repos/sinbad/git-lfs/subscription","commits_url":"https://api.github.com/repos/sinbad/git-lfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sinbad/git-lfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sinbad/git-lfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sinbad/git-lfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sinbad/git-lfs/contents/{+path}","compare_url":"https://api.github.com/repos/sinbad/git-lfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sinbad/git-lfs/merges","archive_url":"https://api.github.com/repos/sinbad/git-lfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sinbad/git-lfs/downloads","issues_url":"https://api.github.com/repos/sinbad/git-lfs/issues{/number}","pulls_url":"https://api.github.com/repos/sinbad/git-lfs/pulls{/number}","milestones_url":"https://api.github.com/repos/sinbad/git-lfs/milestones{/number}","notifications_url":"https://api.github.com/repos/sinbad/git-lfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sinbad/git-lfs/labels{/name}","releases_url":"https://api.github.com/repos/sinbad/git-lfs/releases{/id}","created_at":"2015-05-20T11:08:57Z","updated_at":"2015-05-20T11:08:58Z","pushed_at":"2015-07-28T09:39:12Z","git_url":"git://github.com/sinbad/git-lfs.git","ssh_url":"git@github.com:sinbad/git-lfs.git","clone_url":"https://github.com/sinbad/git-lfs.git","svn_url":"https://github.com/sinbad/git-lfs","homepage":"https://git-lfs.github.com","size":3944,"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":"github:master","ref":"master","sha":"fac4434fe3bed233dae4443657d58641d8d4d255","user":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"repo":{"id":13021798,"name":"git-lfs","full_name":"github/git-lfs","owner":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/github/git-lfs","description":"Git extension for versioning large files","fork":false,"url":"https://api.github.com/repos/github/git-lfs","forks_url":"https://api.github.com/repos/github/git-lfs/forks","keys_url":"https://api.github.com/repos/github/git-lfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/github/git-lfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/github/git-lfs/teams","hooks_url":"https://api.github.com/repos/github/git-lfs/hooks","issue_events_url":"https://api.github.com/repos/github/git-lfs/issues/events{/number}","events_url":"https://api.github.com/repos/github/git-lfs/events","assignees_url":"https://api.github.com/repos/github/git-lfs/assignees{/user}","branches_url":"https://api.github.com/repos/github/git-lfs/branches{/branch}","tags_url":"https://api.github.com/repos/github/git-lfs/tags","blobs_url":"https://api.github.com/repos/github/git-lfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/github/git-lfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/github/git-lfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/github/git-lfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/{sha}","languages_url":"https://api.github.com/repos/github/git-lfs/languages","stargazers_url":"https://api.github.com/repos/github/git-lfs/stargazers","contributors_url":"https://api.github.com/repos/github/git-lfs/contributors","subscribers_url":"https://api.github.com/repos/github/git-lfs/subscribers","subscription_url":"https://api.github.com/repos/github/git-lfs/subscription","commits_url":"https://api.github.com/repos/github/git-lfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/github/git-lfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/github/git-lfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/github/git-lfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/github/git-lfs/contents/{+path}","compare_url":"https://api.github.com/repos/github/git-lfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/github/git-lfs/merges","archive_url":"https://api.github.com/repos/github/git-lfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/github/git-lfs/downloads","issues_url":"https://api.github.com/repos/github/git-lfs/issues{/number}","pulls_url":"https://api.github.com/repos/github/git-lfs/pulls{/number}","milestones_url":"https://api.github.com/repos/github/git-lfs/milestones{/number}","notifications_url":"https://api.github.com/repos/github/git-lfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/github/git-lfs/labels{/name}","releases_url":"https://api.github.com/repos/github/git-lfs/releases{/id}","created_at":"2013-09-22T22:03:28Z","updated_at":"2015-07-28T06:00:51Z","pushed_at":"2015-07-28T09:39:12Z","git_url":"git://github.com/github/git-lfs.git","ssh_url":"git@github.com:github/git-lfs.git","clone_url":"https://github.com/github/git-lfs.git","svn_url":"https://github.com/github/git-lfs","homepage":"https://git-lfs.github.com","size":9270,"stargazers_count":2180,"watchers_count":2180,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":101,"forks":137,"open_issues":101,"watchers":2180,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/527"},"html":{"href":"https://github.com/github/git-lfs/pull/527"},"issue":{"href":"https://api.github.com/repos/github/git-lfs/issues/527"},"comments":{"href":"https://api.github.com/repos/github/git-lfs/issues/527/comments"},"review_comments":{"href":"https://api.github.com/repos/github/git-lfs/pulls/527/comments"},"review_comment":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/github/git-lfs/pulls/527/commits"},"statuses":{"href":"https://api.github.com/repos/github/git-lfs/statuses/9a793dd747219b4683b9a99f52f67fac7465977f"}}}}