{"action":"created","comment":{"url":"https://api.github.com/repos/github/git-lfs/pulls/comments/54931061","id":54931061,"diff_hunk":"@@ -137,7 +133,19 @@ func prePushRef(left, right string) {\n \t\t\tos.Exit(2)\n \t\t}\n \t}\n+}\n+\n+func filteredPointers(pointers []*lfs.WrappedPointer, filter lfs.StringSet) []*lfs.WrappedPointer {","path":"commands/command_pre_push.go","position":73,"original_position":73,"commit_id":"bde853fd083f7a1b6128c6537c2030b21151b422","original_commit_id":"bde853fd083f7a1b6128c6537c2030b21151b422","user":{"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},"body":"How about this? https://gist.github.com/technoweenie/34671a1296ba375b477a\r\n\r\n```bash\r\n$ go test -bench . -run BenchmarkFilterByChan\r\ntesting: warning: no tests to run\r\nPASS\r\nBenchmarkFilterByList-4    \t    1000\t   1871779 ns/op\r\nBenchmarkFilterByCallback-4\t    1000\t   1653444 ns/op\r\nBenchmarkFilterByChan-4    \t     200\t   9165917 ns/op\r\n```\r\n\r\nStill leaning towards the current approach. It's not much slower than using a callback, and has the simplest implementation. Unless there's some radical way to make the channel approach simpler and faster, I'm not even really considering it.","created_at":"2016-03-03T19:14:16Z","updated_at":"2016-03-03T19:14:16Z","html_url":"https://github.com/github/git-lfs/pull/1040#discussion_r54931061","pull_request_url":"https://api.github.com/repos/github/git-lfs/pulls/1040","_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments/54931061"},"html":{"href":"https://github.com/github/git-lfs/pull/1040#discussion_r54931061"},"pull_request":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1040"}}},"pull_request":{"url":"https://api.github.com/repos/github/git-lfs/pulls/1040","id":60561939,"html_url":"https://github.com/github/git-lfs/pull/1040","diff_url":"https://github.com/github/git-lfs/pull/1040.diff","patch_url":"https://github.com/github/git-lfs/pull/1040.patch","issue_url":"https://api.github.com/repos/github/git-lfs/issues/1040","number":1040,"state":"open","locked":false,"title":"improve initial pre-push imports","user":{"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},"body":"When pushing a repository to a new host, Git LFS pushes each branch or tag individually. This leads to a lot of skipped objects. Assuming all branches are based on master, then there should be a lot of duplicate objects. Here's a push with a repository with 502 objects: 501 in master, and an extra in another branch:\r\n\r\n```bash\r\n$ time git push 5 --all\r\nGit LFS: (501 of 501 files) 1.85 KB / 1.85 KB\r\nGit LFS: (0 of 501 files, 501 skipped) 0 B / 1.85 KB, 1.85 KB skipped\r\nGit LFS: (1 of 502 files, 501 skipped) 3 B / 1.86 KB, 1.85 KB skipped\r\nGit LFS: (0 of 501 files, 501 skipped) 0 B / 1.85 KB, 1.85 KB skipped\r\nCounting objects: 516, done.\r\nDelta compression using up to 4 threads.\r\nCompressing objects: 100% (511/511), done.\r\nWriting objects: 100% (516/516), 70.52 KiB | 0 bytes/s, done.\r\nTotal 516 (delta 1), reused 512 (delta 0)\r\nTo https://git-server/technoweenie/symmetrical-octo-pancake\r\n * [new branch]      1 -> 1\r\n * [new branch]      2 -> 2\r\n * [new branch]      3 -> 3\r\n * [new branch]      master -> master\r\ngit push 5 --all  2.06s user 1.51s system 7% cpu 51.051 total\r\n```\r\n\r\nWith this PR:\r\n\r\n```bash\r\n$ time git push 4 --all\r\nGit LFS: (501 of 501 files) 1.85 KB / 1.85 KB\r\nGit LFS: (1 of 1 files) 3 B / 3 B\r\nCounting objects: 516, done.\r\nDelta compression using up to 4 threads.\r\nCompressing objects: 100% (511/511), done.\r\nWriting objects: 100% (516/516), 70.52 KiB | 0 bytes/s, done.\r\nTotal 516 (delta 1), reused 512 (delta 0)\r\nTo https://git-server/technoweenie/symmetrical-octo-funicular\r\n * [new branch]      1 -> 1\r\n * [new branch]      2 -> 2\r\n * [new branch]      3 -> 3\r\n * [new branch]      master -> master\r\ngit push 4 --all  1.62s user 0.89s system 5% cpu 45.280 total\r\n```","created_at":"2016-02-24T19:14:10Z","updated_at":"2016-03-03T19:14:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0b6edae9135573c4ad192ed062e7a2ba0ee1b11","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/github/git-lfs/pulls/1040/commits","review_comments_url":"https://api.github.com/repos/github/git-lfs/pulls/1040/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/1040/comments","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/bde853fd083f7a1b6128c6537c2030b21151b422","head":{"label":"github:skip-pre-push-dupes","ref":"skip-pre-push-dupes","sha":"bde853fd083f7a1b6128c6537c2030b21151b422","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}","deployments_url":"https://api.github.com/repos/github/git-lfs/deployments","created_at":"2013-09-22T22:03:28Z","updated_at":"2016-03-03T03:06:18Z","pushed_at":"2016-03-03T18:03:50Z","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":9378,"stargazers_count":3317,"watchers_count":3317,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":363,"mirror_url":null,"open_issues_count":232,"forks":363,"open_issues":232,"watchers":3317,"default_branch":"master"}},"base":{"label":"github:master","ref":"master","sha":"6b00ebc996a7cd2b28fdcd027fe527c48975c113","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}","deployments_url":"https://api.github.com/repos/github/git-lfs/deployments","created_at":"2013-09-22T22:03:28Z","updated_at":"2016-03-03T03:06:18Z","pushed_at":"2016-03-03T18:03:50Z","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":9378,"stargazers_count":3317,"watchers_count":3317,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":363,"mirror_url":null,"open_issues_count":232,"forks":363,"open_issues":232,"watchers":3317,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1040"},"html":{"href":"https://github.com/github/git-lfs/pull/1040"},"issue":{"href":"https://api.github.com/repos/github/git-lfs/issues/1040"},"comments":{"href":"https://api.github.com/repos/github/git-lfs/issues/1040/comments"},"review_comments":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1040/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/1040/commits"},"statuses":{"href":"https://api.github.com/repos/github/git-lfs/statuses/bde853fd083f7a1b6128c6537c2030b21151b422"}}}}