{"action":"created","comment":{"url":"https://api.github.com/repos/src-d/go-git/pulls/comments/98513488","pull_request_review_id":19157369,"id":98513488,"diff_hunk":"@@ -0,0 +1,73 @@\n+package fsnoder\n+\n+import (\n+\t\"bytes\"\n+\t\"fmt\"\n+\t\"hash/fnv\"\n+\n+\t\"gopkg.in/src-d/go-git.v4/utils/merkletrie/noder\"\n+)\n+\n+// file values represent file-like noders in a merkle trie.\n+type file struct {\n+\tname     string // relative\n+\tcontents string\n+\thash     []byte // memoized\n+}\n+\n+// newFile returns a noder representing a file with the given contents.\n+func newFile(name, contents string) (*file, error) {\n+\tif name == \"\" {\n+\t\treturn nil, fmt.Errorf(\"files cannot have empty names\")\n+\t}\n+\n+\treturn &file{\n+\t\tname:     name,\n+\t\tcontents: contents,\n+\t}, nil\n+}\n+\n+// The hash of a file is just its contents.\n+// Empty files will have the fnv64 basis offset as its hash.\n+func (f *file) Hash() []byte {\n+\tif f.hash == nil {\n+\t\th := fnv.New64a()\n+\t\th.Write([]byte(f.contents))\n+\t\tf.hash = []byte{}","path":"utils/merkletrie/fsnoder/file.go","position":36,"original_position":36,"commit_id":"87a55200a36a2554e6a3f4723a57ee9ab2ab9546","original_commit_id":"25c132e26342f1692dd65d51927f704951ab1564","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":"You are totally right! Fixed!","created_at":"2017-01-30T18:57:36Z","updated_at":"2017-01-30T18:57:36Z","html_url":"https://github.com/src-d/go-git/pull/241#discussion_r98513488","pull_request_url":"https://api.github.com/repos/src-d/go-git/pulls/241","_links":{"self":{"href":"https://api.github.com/repos/src-d/go-git/pulls/comments/98513488"},"html":{"href":"https://github.com/src-d/go-git/pull/241#discussion_r98513488"},"pull_request":{"href":"https://api.github.com/repos/src-d/go-git/pulls/241"}}},"pull_request":{"url":"https://api.github.com/repos/src-d/go-git/pulls/241","id":103728780,"html_url":"https://github.com/src-d/go-git/pull/241","diff_url":"https://github.com/src-d/go-git/pull/241.diff","patch_url":"https://github.com/src-d/go-git/pull/241.patch","issue_url":"https://api.github.com/repos/src-d/go-git/issues/241","number":241,"state":"open","locked":false,"title":"Improved merkletrie, moved to utils.","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":"This patch adds support for https://github.com/src-d/go-git/issues/82.\r\n\r\nThe old merkletrie noder, iters and frames need a better implementation to be useful to implement a working difftree:\r\n\r\n- The noder lacked support for returning errors when getting their children, which can happen in real life implementations of the noders.\r\n- The iterator did not support getting full paths on its outputs so you didn't know where in the tree were the noders returned by the iterator.\r\n- Also the hash comparison function was not part of the API, so you weren't able to overwrite it.\r\n\r\nThis patch is the basic support to solve all these issues. It removes the old merkletrie and creates a new one in `utils/merkletrie`. The new package defines the basic interface for the noders in the merkletrie and a reference implementation for tests.\r\n\r\nThe recommended order to review this patch is:\r\n\r\nThe noder interface:\r\n- `utils/merkletrie/doc.go`\r\n- `utils/merkletrie/hasher/hasher.go`\r\n- `utils/merkletrie/noder/noder.go`\r\n- `utils/merkletrie/noder/node_test.go`\r\n- `utils/merkletrie/noder/path.go`\r\n\r\nA reference implementation of the noder interface for tests:\r\n- `utils/merkletrie/fsnoder/doc.go`\r\n- `utils/merkletrie/fsnoder/dir.go`\r\n- `utils/merkletrie/fsnoder/dir_test.go`\r\n- `utils/merkletrie/fsnoder/file.go`\r\n- `utils/merkletrie/fsnoder/file_test.go`\r\n- `utils/merkletrie/fsnoder/new.go`\r\n- `utils/merkletrie/fsnoder/new_test.go`\r\n\r\nPS: the missing iter and frame types will come in future PRs.","created_at":"2017-01-30T12:42:01Z","updated_at":"2017-01-30T18:57:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ad023be2140d8fbe3021ff25d493cbad5814bc1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/src-d/go-git/pulls/241/commits","review_comments_url":"https://api.github.com/repos/src-d/go-git/pulls/241/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/241/comments","statuses_url":"https://api.github.com/repos/src-d/go-git/statuses/87a55200a36a2554e6a3f4723a57ee9ab2ab9546","head":{"label":"alcortesm:new-merkletrie-in-utils","ref":"new-merkletrie-in-utils","sha":"87a55200a36a2554e6a3f4723a57ee9ab2ab9546","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},"repo":{"id":44801835,"name":"go-git","full_name":"alcortesm/go-git","owner":{"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},"private":false,"html_url":"https://github.com/alcortesm/go-git","description":"dependency free git client ","fork":true,"url":"https://api.github.com/repos/alcortesm/go-git","forks_url":"https://api.github.com/repos/alcortesm/go-git/forks","keys_url":"https://api.github.com/repos/alcortesm/go-git/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alcortesm/go-git/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alcortesm/go-git/teams","hooks_url":"https://api.github.com/repos/alcortesm/go-git/hooks","issue_events_url":"https://api.github.com/repos/alcortesm/go-git/issues/events{/number}","events_url":"https://api.github.com/repos/alcortesm/go-git/events","assignees_url":"https://api.github.com/repos/alcortesm/go-git/assignees{/user}","branches_url":"https://api.github.com/repos/alcortesm/go-git/branches{/branch}","tags_url":"https://api.github.com/repos/alcortesm/go-git/tags","blobs_url":"https://api.github.com/repos/alcortesm/go-git/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alcortesm/go-git/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alcortesm/go-git/git/refs{/sha}","trees_url":"https://api.github.com/repos/alcortesm/go-git/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alcortesm/go-git/statuses/{sha}","languages_url":"https://api.github.com/repos/alcortesm/go-git/languages","stargazers_url":"https://api.github.com/repos/alcortesm/go-git/stargazers","contributors_url":"https://api.github.com/repos/alcortesm/go-git/contributors","subscribers_url":"https://api.github.com/repos/alcortesm/go-git/subscribers","subscription_url":"https://api.github.com/repos/alcortesm/go-git/subscription","commits_url":"https://api.github.com/repos/alcortesm/go-git/commits{/sha}","git_commits_url":"https://api.github.com/repos/alcortesm/go-git/git/commits{/sha}","comments_url":"https://api.github.com/repos/alcortesm/go-git/comments{/number}","issue_comment_url":"https://api.github.com/repos/alcortesm/go-git/issues/comments{/number}","contents_url":"https://api.github.com/repos/alcortesm/go-git/contents/{+path}","compare_url":"https://api.github.com/repos/alcortesm/go-git/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alcortesm/go-git/merges","archive_url":"https://api.github.com/repos/alcortesm/go-git/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alcortesm/go-git/downloads","issues_url":"https://api.github.com/repos/alcortesm/go-git/issues{/number}","pulls_url":"https://api.github.com/repos/alcortesm/go-git/pulls{/number}","milestones_url":"https://api.github.com/repos/alcortesm/go-git/milestones{/number}","notifications_url":"https://api.github.com/repos/alcortesm/go-git/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alcortesm/go-git/labels{/name}","releases_url":"https://api.github.com/repos/alcortesm/go-git/releases{/id}","deployments_url":"https://api.github.com/repos/alcortesm/go-git/deployments","created_at":"2015-10-23T08:53:39Z","updated_at":"2016-10-25T07:20:44Z","pushed_at":"2017-01-30T17:11:40Z","git_url":"git://github.com/alcortesm/go-git.git","ssh_url":"git@github.com:alcortesm/go-git.git","clone_url":"https://github.com/alcortesm/go-git.git","svn_url":"https://github.com/alcortesm/go-git","homepage":"","size":61017,"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":"61aec950c025cad0c8ea8f758ddf691168ec0264","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 implementation in pure Go.","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":"2017-01-29T22:06:38Z","pushed_at":"2017-01-30T18:04:49Z","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.v4","size":60828,"stargazers_count":1074,"watchers_count":1074,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":23,"forks":63,"open_issues":23,"watchers":1074,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/src-d/go-git/pulls/241"},"html":{"href":"https://github.com/src-d/go-git/pull/241"},"issue":{"href":"https://api.github.com/repos/src-d/go-git/issues/241"},"comments":{"href":"https://api.github.com/repos/src-d/go-git/issues/241/comments"},"review_comments":{"href":"https://api.github.com/repos/src-d/go-git/pulls/241/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/241/commits"},"statuses":{"href":"https://api.github.com/repos/src-d/go-git/statuses/87a55200a36a2554e6a3f4723a57ee9ab2ab9546"}}}}
{"actor":{"display_login":"alcortesm"}}