{"action":"created","comment":{"url":"https://api.github.com/repos/src-d/go-git/pulls/comments/89285947","pull_request_review_id":9822077,"id":89285947,"diff_hunk":"@@ -0,0 +1,115 @@\n+package packfile\n+\n+import (\n+\t\"crypto/sha1\"\n+\t\"fmt\"\n+\t\"hash\"\n+\t\"io\"\n+\n+\t\"gopkg.in/src-d/go-git.v4/plumbing\"\n+\t\"gopkg.in/src-d/go-git.v4/plumbing/storer\"\n+\t\"gopkg.in/src-d/go-git.v4/utils/binary\"\n+\n+\t\"github.com/klauspost/compress/zlib\"\n+)\n+\n+// Encoder gets the data from the storage and write it into the writer in PACK\n+// format\n+type Encoder struct {\n+\tstorage storer.ObjectStorer\n+\tw       io.Writer\n+\thash    hash.Hash\n+}\n+\n+// NewEncoder creates a new packfile encoder using a specific Writer and\n+// ObjectStorer\n+func NewEncoder(w io.Writer, s storer.ObjectStorer) *Encoder {\n+\th := sha1.New()\n+\tmw := io.MultiWriter(w, h)\n+\treturn &Encoder{\n+\t\tstorage: s,\n+\t\tw:       mw,\n+\t\thash:    h,\n+\t}\n+}\n+\n+// Encode encodes objects specified using a list of hashes. This objects must\n+// exists into the storer\n+func (e *Encoder) Encode(hashes []plumbing.Hash) (plumbing.Hash, error) {","path":"plumbing/format/packfile/encoder.go","position":38,"original_position":38,"commit_id":"e0a8e7df0ff8134ced5b45ef59fef4b8bae7a343","original_commit_id":"e0a8e7df0ff8134ced5b45ef59fef4b8bae7a343","user":{"login":"alcortesm","id":9169414,"avatar_url":"https://avatars.githubusercontent.com/u/9169414?v=3","gravatar_id":"","url":"https://api.github.com/users/alcortesm","html_url":"https://github.com/alcortesm","followers_url":"https://api.github.com/users/alcortesm/followers","following_url":"https://api.github.com/users/alcortesm/following{/other_user}","gists_url":"https://api.github.com/users/alcortesm/gists{/gist_id}","starred_url":"https://api.github.com/users/alcortesm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcortesm/subscriptions","organizations_url":"https://api.github.com/users/alcortesm/orgs","repos_url":"https://api.github.com/users/alcortesm/repos","events_url":"https://api.github.com/users/alcortesm/events{/privacy}","received_events_url":"https://api.github.com/users/alcortesm/received_events","type":"User","site_admin":false},"body":"From the signature of the method and the comments it is not clear if you can create a **single** packfile by calling several times in a row to **Encode**.\r\n\r\nI would change the comment here to clarify that every time you call Encode it **creates a new packfile** and write it to the writer. Something like this:\r\n\r\n```\r\n// Encode creates a packfile containing all the objects referenced in hashes and writes it to the writer in the Encoder.\r\n```\r\n","created_at":"2016-11-23T10:14:45Z","updated_at":"2016-11-23T10:36:16Z","html_url":"https://github.com/src-d/go-git/pull/131#discussion_r89285947","pull_request_url":"https://api.github.com/repos/src-d/go-git/pulls/131","_links":{"self":{"href":"https://api.github.com/repos/src-d/go-git/pulls/comments/89285947"},"html":{"href":"https://github.com/src-d/go-git/pull/131#discussion_r89285947"},"pull_request":{"href":"https://api.github.com/repos/src-d/go-git/pulls/131"}}},"pull_request":{"url":"https://api.github.com/repos/src-d/go-git/pulls/131","id":94770114,"html_url":"https://github.com/src-d/go-git/pull/131","diff_url":"https://github.com/src-d/go-git/pull/131.diff","patch_url":"https://github.com/src-d/go-git/pull/131.patch","issue_url":"https://api.github.com/repos/src-d/go-git/issues/131","number":131,"state":"open","locked":false,"title":"plumbing/packfile: PACK encoder","user":{"login":"ajnavarro","id":1196465,"avatar_url":"https://avatars.githubusercontent.com/u/1196465?v=3","gravatar_id":"","url":"https://api.github.com/users/ajnavarro","html_url":"https://github.com/ajnavarro","followers_url":"https://api.github.com/users/ajnavarro/followers","following_url":"https://api.github.com/users/ajnavarro/following{/other_user}","gists_url":"https://api.github.com/users/ajnavarro/gists{/gist_id}","starred_url":"https://api.github.com/users/ajnavarro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajnavarro/subscriptions","organizations_url":"https://api.github.com/users/ajnavarro/orgs","repos_url":"https://api.github.com/users/ajnavarro/repos","events_url":"https://api.github.com/users/ajnavarro/events{/privacy}","received_events_url":"https://api.github.com/users/ajnavarro/received_events","type":"User","site_admin":false},"body":"- Added simple PACK encoder, deltas not supported by now","created_at":"2016-11-22T08:46:51Z","updated_at":"2016-11-23T10:36:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6e7072a4f02911997837cd08ed031edfa30efe9b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/src-d/go-git/pulls/131/commits","review_comments_url":"https://api.github.com/repos/src-d/go-git/pulls/131/comments","review_comment_url":"https://api.github.com/repos/src-d/go-git/pulls/comments{/number}","comments_url":"https://api.github.com/repos/src-d/go-git/issues/131/comments","statuses_url":"https://api.github.com/repos/src-d/go-git/statuses/e0a8e7df0ff8134ced5b45ef59fef4b8bae7a343","head":{"label":"ajnavarro:feature/pack-encoder","ref":"feature/pack-encoder","sha":"e0a8e7df0ff8134ced5b45ef59fef4b8bae7a343","user":{"login":"ajnavarro","id":1196465,"avatar_url":"https://avatars.githubusercontent.com/u/1196465?v=3","gravatar_id":"","url":"https://api.github.com/users/ajnavarro","html_url":"https://github.com/ajnavarro","followers_url":"https://api.github.com/users/ajnavarro/followers","following_url":"https://api.github.com/users/ajnavarro/following{/other_user}","gists_url":"https://api.github.com/users/ajnavarro/gists{/gist_id}","starred_url":"https://api.github.com/users/ajnavarro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajnavarro/subscriptions","organizations_url":"https://api.github.com/users/ajnavarro/orgs","repos_url":"https://api.github.com/users/ajnavarro/repos","events_url":"https://api.github.com/users/ajnavarro/events{/privacy}","received_events_url":"https://api.github.com/users/ajnavarro/received_events","type":"User","site_admin":false},"repo":{"id":72841352,"name":"go-git","full_name":"ajnavarro/go-git","owner":{"login":"ajnavarro","id":1196465,"avatar_url":"https://avatars.githubusercontent.com/u/1196465?v=3","gravatar_id":"","url":"https://api.github.com/users/ajnavarro","html_url":"https://github.com/ajnavarro","followers_url":"https://api.github.com/users/ajnavarro/followers","following_url":"https://api.github.com/users/ajnavarro/following{/other_user}","gists_url":"https://api.github.com/users/ajnavarro/gists{/gist_id}","starred_url":"https://api.github.com/users/ajnavarro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajnavarro/subscriptions","organizations_url":"https://api.github.com/users/ajnavarro/orgs","repos_url":"https://api.github.com/users/ajnavarro/repos","events_url":"https://api.github.com/users/ajnavarro/events{/privacy}","received_events_url":"https://api.github.com/users/ajnavarro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajnavarro/go-git","description":"A low level and highly extensible git client library","fork":true,"url":"https://api.github.com/repos/ajnavarro/go-git","forks_url":"https://api.github.com/repos/ajnavarro/go-git/forks","keys_url":"https://api.github.com/repos/ajnavarro/go-git/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajnavarro/go-git/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajnavarro/go-git/teams","hooks_url":"https://api.github.com/repos/ajnavarro/go-git/hooks","issue_events_url":"https://api.github.com/repos/ajnavarro/go-git/issues/events{/number}","events_url":"https://api.github.com/repos/ajnavarro/go-git/events","assignees_url":"https://api.github.com/repos/ajnavarro/go-git/assignees{/user}","branches_url":"https://api.github.com/repos/ajnavarro/go-git/branches{/branch}","tags_url":"https://api.github.com/repos/ajnavarro/go-git/tags","blobs_url":"https://api.github.com/repos/ajnavarro/go-git/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajnavarro/go-git/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajnavarro/go-git/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajnavarro/go-git/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajnavarro/go-git/statuses/{sha}","languages_url":"https://api.github.com/repos/ajnavarro/go-git/languages","stargazers_url":"https://api.github.com/repos/ajnavarro/go-git/stargazers","contributors_url":"https://api.github.com/repos/ajnavarro/go-git/contributors","subscribers_url":"https://api.github.com/repos/ajnavarro/go-git/subscribers","subscription_url":"https://api.github.com/repos/ajnavarro/go-git/subscription","commits_url":"https://api.github.com/repos/ajnavarro/go-git/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajnavarro/go-git/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajnavarro/go-git/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajnavarro/go-git/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajnavarro/go-git/contents/{+path}","compare_url":"https://api.github.com/repos/ajnavarro/go-git/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajnavarro/go-git/merges","archive_url":"https://api.github.com/repos/ajnavarro/go-git/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajnavarro/go-git/downloads","issues_url":"https://api.github.com/repos/ajnavarro/go-git/issues{/number}","pulls_url":"https://api.github.com/repos/ajnavarro/go-git/pulls{/number}","milestones_url":"https://api.github.com/repos/ajnavarro/go-git/milestones{/number}","notifications_url":"https://api.github.com/repos/ajnavarro/go-git/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajnavarro/go-git/labels{/name}","releases_url":"https://api.github.com/repos/ajnavarro/go-git/releases{/id}","deployments_url":"https://api.github.com/repos/ajnavarro/go-git/deployments","created_at":"2016-11-04T11:21:44Z","updated_at":"2016-11-04T11:21:45Z","pushed_at":"2016-11-22T11:15:34Z","git_url":"git://github.com/ajnavarro/go-git.git","ssh_url":"git@github.com:ajnavarro/go-git.git","clone_url":"https://github.com/ajnavarro/go-git.git","svn_url":"https://github.com/ajnavarro/go-git","homepage":"https://godoc.org/gopkg.in/src-d/go-git.v3","size":60344,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"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":"src-d:master","ref":"master","sha":"cdddca6f78b4c0bb975aab235769f4709fc3a8b6","user":{"login":"src-d","id":15128793,"avatar_url":"https://avatars.githubusercontent.com/u/15128793?v=3","gravatar_id":"","url":"https://api.github.com/users/src-d","html_url":"https://github.com/src-d","followers_url":"https://api.github.com/users/src-d/followers","following_url":"https://api.github.com/users/src-d/following{/other_user}","gists_url":"https://api.github.com/users/src-d/gists{/gist_id}","starred_url":"https://api.github.com/users/src-d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/src-d/subscriptions","organizations_url":"https://api.github.com/users/src-d/orgs","repos_url":"https://api.github.com/users/src-d/repos","events_url":"https://api.github.com/users/src-d/events{/privacy}","received_events_url":"https://api.github.com/users/src-d/received_events","type":"Organization","site_admin":false},"repo":{"id":44739044,"name":"go-git","full_name":"src-d/go-git","owner":{"login":"src-d","id":15128793,"avatar_url":"https://avatars.githubusercontent.com/u/15128793?v=3","gravatar_id":"","url":"https://api.github.com/users/src-d","html_url":"https://github.com/src-d","followers_url":"https://api.github.com/users/src-d/followers","following_url":"https://api.github.com/users/src-d/following{/other_user}","gists_url":"https://api.github.com/users/src-d/gists{/gist_id}","starred_url":"https://api.github.com/users/src-d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/src-d/subscriptions","organizations_url":"https://api.github.com/users/src-d/orgs","repos_url":"https://api.github.com/users/src-d/repos","events_url":"https://api.github.com/users/src-d/events{/privacy}","received_events_url":"https://api.github.com/users/src-d/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/src-d/go-git","description":"A low level and highly extensible git client library","fork":false,"url":"https://api.github.com/repos/src-d/go-git","forks_url":"https://api.github.com/repos/src-d/go-git/forks","keys_url":"https://api.github.com/repos/src-d/go-git/keys{/key_id}","collaborators_url":"https://api.github.com/repos/src-d/go-git/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/src-d/go-git/teams","hooks_url":"https://api.github.com/repos/src-d/go-git/hooks","issue_events_url":"https://api.github.com/repos/src-d/go-git/issues/events{/number}","events_url":"https://api.github.com/repos/src-d/go-git/events","assignees_url":"https://api.github.com/repos/src-d/go-git/assignees{/user}","branches_url":"https://api.github.com/repos/src-d/go-git/branches{/branch}","tags_url":"https://api.github.com/repos/src-d/go-git/tags","blobs_url":"https://api.github.com/repos/src-d/go-git/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/src-d/go-git/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/src-d/go-git/git/refs{/sha}","trees_url":"https://api.github.com/repos/src-d/go-git/git/trees{/sha}","statuses_url":"https://api.github.com/repos/src-d/go-git/statuses/{sha}","languages_url":"https://api.github.com/repos/src-d/go-git/languages","stargazers_url":"https://api.github.com/repos/src-d/go-git/stargazers","contributors_url":"https://api.github.com/repos/src-d/go-git/contributors","subscribers_url":"https://api.github.com/repos/src-d/go-git/subscribers","subscription_url":"https://api.github.com/repos/src-d/go-git/subscription","commits_url":"https://api.github.com/repos/src-d/go-git/commits{/sha}","git_commits_url":"https://api.github.com/repos/src-d/go-git/git/commits{/sha}","comments_url":"https://api.github.com/repos/src-d/go-git/comments{/number}","issue_comment_url":"https://api.github.com/repos/src-d/go-git/issues/comments{/number}","contents_url":"https://api.github.com/repos/src-d/go-git/contents/{+path}","compare_url":"https://api.github.com/repos/src-d/go-git/compare/{base}...{head}","merges_url":"https://api.github.com/repos/src-d/go-git/merges","archive_url":"https://api.github.com/repos/src-d/go-git/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/src-d/go-git/downloads","issues_url":"https://api.github.com/repos/src-d/go-git/issues{/number}","pulls_url":"https://api.github.com/repos/src-d/go-git/pulls{/number}","milestones_url":"https://api.github.com/repos/src-d/go-git/milestones{/number}","notifications_url":"https://api.github.com/repos/src-d/go-git/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/src-d/go-git/labels{/name}","releases_url":"https://api.github.com/repos/src-d/go-git/releases{/id}","deployments_url":"https://api.github.com/repos/src-d/go-git/deployments","created_at":"2015-10-22T10:43:33Z","updated_at":"2016-11-22T00:34:01Z","pushed_at":"2016-11-23T09:23:33Z","git_url":"git://github.com/src-d/go-git.git","ssh_url":"git@github.com:src-d/go-git.git","clone_url":"https://github.com/src-d/go-git.git","svn_url":"https://github.com/src-d/go-git","homepage":"https://godoc.org/gopkg.in/src-d/go-git.v3","size":61014,"stargazers_count":975,"watchers_count":975,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":12,"forks":50,"open_issues":12,"watchers":975,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/src-d/go-git/pulls/131"},"html":{"href":"https://github.com/src-d/go-git/pull/131"},"issue":{"href":"https://api.github.com/repos/src-d/go-git/issues/131"},"comments":{"href":"https://api.github.com/repos/src-d/go-git/issues/131/comments"},"review_comments":{"href":"https://api.github.com/repos/src-d/go-git/pulls/131/comments"},"review_comment":{"href":"https://api.github.com/repos/src-d/go-git/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/src-d/go-git/pulls/131/commits"},"statuses":{"href":"https://api.github.com/repos/src-d/go-git/statuses/e0a8e7df0ff8134ced5b45ef59fef4b8bae7a343"}}}}
{"actor":{"display_login":"alcortesm"}}