{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/comments/169748827","pull_request_review_id":98326261,"id":169748827,"diff_hunk":"@@ -155,45 +153,68 @@ func Serve(c *fuse.Conn, node Dir, dynamic *DynamicConf) error {\n \treturn server.Serve(f)\n }\n \n-// Init initializes a new fs.Node instance to represent a sandboxfs file system\n-// rooted in the given directory.\n-func Init(mappingsInput []MappingSpec) (Dir, error) {\n-\t// Clone the list so that we don't modify the passed slice.\n-\tmappings := append([]MappingSpec(nil), mappingsInput...)\n+// tokenizePath splits a path into its components. An empty path results in an empty list, and an\n+// absolute path (including root) results in an empty component as the first item in the result.\n+func tokenizePath(path string) []string {\n+\tpath = filepath.Clean(path)\n+\tif path == \".\" {\n+\t\treturn []string{}\n+\t} else if path == \"/\" {\n+\t\treturn []string{\"\"}\n+\t}\n \n-\t// This sort helps us ensure that a mapping will only have to be created\n-\t// where one either does not exist or is a ScaffoldDir (since the more\n-\t// nested mappings will be handled first).\n-\t// Note that the order of different paths with the same length doesn't\n-\t// matter since one can never be a prefix of the other.\n-\tsort.Slice(mappings, func(i, j int) bool {\n-\t\treturn len(mappings[i].Mapping) > len(mappings[j].Mapping)\n-\t})\n+\ttokens := []string{}\n+\tlastI := 0","path":"internal/sandbox/sandbox.go","position":46,"original_position":46,"commit_id":"71fe15eb3ec3548180728bf72d364741d92b085b","original_commit_id":"71fe15eb3ec3548180728bf72d364741d92b085b","user":{"login":"jmmv","id":879272,"avatar_url":"https://avatars0.githubusercontent.com/u/879272?v=4","gravatar_id":"","url":"https://api.github.com/users/jmmv","html_url":"https://github.com/jmmv","followers_url":"https://api.github.com/users/jmmv/followers","following_url":"https://api.github.com/users/jmmv/following{/other_user}","gists_url":"https://api.github.com/users/jmmv/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmv/subscriptions","organizations_url":"https://api.github.com/users/jmmv/orgs","repos_url":"https://api.github.com/users/jmmv/repos","events_url":"https://api.github.com/users/jmmv/events{/privacy}","received_events_url":"https://api.github.com/users/jmmv/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2018-02-21T19:20:47Z","updated_at":"2018-02-21T19:20:47Z","html_url":"https://github.com/bazelbuild/sandboxfs/pull/14#discussion_r169748827","pull_request_url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/comments/169748827"},"html":{"href":"https://github.com/bazelbuild/sandboxfs/pull/14#discussion_r169748827"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14"}},"in_reply_to_id":168256410},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14","id":168235046,"html_url":"https://github.com/bazelbuild/sandboxfs/pull/14","diff_url":"https://github.com/bazelbuild/sandboxfs/pull/14.diff","patch_url":"https://github.com/bazelbuild/sandboxfs/pull/14.patch","issue_url":"https://api.github.com/repos/bazelbuild/sandboxfs/issues/14","number":14,"state":"open","locked":false,"title":" Unify the representation of directories into a single node type","user":{"login":"jmmv","id":879272,"avatar_url":"https://avatars0.githubusercontent.com/u/879272?v=4","gravatar_id":"","url":"https://api.github.com/users/jmmv","html_url":"https://github.com/jmmv","followers_url":"https://api.github.com/users/jmmv/followers","following_url":"https://api.github.com/users/jmmv/following{/other_user}","gists_url":"https://api.github.com/users/jmmv/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmv/subscriptions","organizations_url":"https://api.github.com/users/jmmv/orgs","repos_url":"https://api.github.com/users/jmmv/repos","events_url":"https://api.github.com/users/jmmv/events{/privacy}","received_events_url":"https://api.github.com/users/jmmv/received_events","type":"User","site_admin":false},"body":"The previous split of MappedDir vs. ScaffoldDir was very complex and got\r\nin the way of upcoming changes to make reconfigurations less intrusive.\r\n\r\nMerging the implementation of ScaffoldDir into MappedDir shows that we\r\ncan represent a directory in a much simpler way: a way that has a single\r\nmapping of directory entries to nodes, not a layered implementation with\r\nthree different maps.\r\n\r\nGranted: the new representation is less flexible than the previous one\r\nand requires mappings to be provided in order by the user, but this\r\nrestriction feels natural anyway and the gained simplicity is worth it.\r\n\r\nNote that, while ScaffoldDir is gone, I'm leaving MappedDir's name\r\nunmodified to keep the churn low in this change.  I'll get rid of the\r\n\"mapped\" prefix later on.","created_at":"2018-02-09T13:07:09Z","updated_at":"2018-02-21T19:20:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97e0a55f8e4dccfbbc5501a24054d3185a5fe8d7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14/comments","review_comment_url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazelbuild/sandboxfs/issues/14/comments","statuses_url":"https://api.github.com/repos/bazelbuild/sandboxfs/statuses/71fe15eb3ec3548180728bf72d364741d92b085b","head":{"label":"jmmv:unify-dirs","ref":"unify-dirs","sha":"71fe15eb3ec3548180728bf72d364741d92b085b","user":{"login":"jmmv","id":879272,"avatar_url":"https://avatars0.githubusercontent.com/u/879272?v=4","gravatar_id":"","url":"https://api.github.com/users/jmmv","html_url":"https://github.com/jmmv","followers_url":"https://api.github.com/users/jmmv/followers","following_url":"https://api.github.com/users/jmmv/following{/other_user}","gists_url":"https://api.github.com/users/jmmv/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmv/subscriptions","organizations_url":"https://api.github.com/users/jmmv/orgs","repos_url":"https://api.github.com/users/jmmv/repos","events_url":"https://api.github.com/users/jmmv/events{/privacy}","received_events_url":"https://api.github.com/users/jmmv/received_events","type":"User","site_admin":false},"repo":{"id":103277477,"name":"sandboxfs","full_name":"jmmv/sandboxfs","owner":{"login":"jmmv","id":879272,"avatar_url":"https://avatars0.githubusercontent.com/u/879272?v=4","gravatar_id":"","url":"https://api.github.com/users/jmmv","html_url":"https://github.com/jmmv","followers_url":"https://api.github.com/users/jmmv/followers","following_url":"https://api.github.com/users/jmmv/following{/other_user}","gists_url":"https://api.github.com/users/jmmv/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmv/subscriptions","organizations_url":"https://api.github.com/users/jmmv/orgs","repos_url":"https://api.github.com/users/jmmv/repos","events_url":"https://api.github.com/users/jmmv/events{/privacy}","received_events_url":"https://api.github.com/users/jmmv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmmv/sandboxfs","description":"A virtual file system for sandboxing","fork":true,"url":"https://api.github.com/repos/jmmv/sandboxfs","forks_url":"https://api.github.com/repos/jmmv/sandboxfs/forks","keys_url":"https://api.github.com/repos/jmmv/sandboxfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmmv/sandboxfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmmv/sandboxfs/teams","hooks_url":"https://api.github.com/repos/jmmv/sandboxfs/hooks","issue_events_url":"https://api.github.com/repos/jmmv/sandboxfs/issues/events{/number}","events_url":"https://api.github.com/repos/jmmv/sandboxfs/events","assignees_url":"https://api.github.com/repos/jmmv/sandboxfs/assignees{/user}","branches_url":"https://api.github.com/repos/jmmv/sandboxfs/branches{/branch}","tags_url":"https://api.github.com/repos/jmmv/sandboxfs/tags","blobs_url":"https://api.github.com/repos/jmmv/sandboxfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmmv/sandboxfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmmv/sandboxfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmmv/sandboxfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmmv/sandboxfs/statuses/{sha}","languages_url":"https://api.github.com/repos/jmmv/sandboxfs/languages","stargazers_url":"https://api.github.com/repos/jmmv/sandboxfs/stargazers","contributors_url":"https://api.github.com/repos/jmmv/sandboxfs/contributors","subscribers_url":"https://api.github.com/repos/jmmv/sandboxfs/subscribers","subscription_url":"https://api.github.com/repos/jmmv/sandboxfs/subscription","commits_url":"https://api.github.com/repos/jmmv/sandboxfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmmv/sandboxfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmmv/sandboxfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmmv/sandboxfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmmv/sandboxfs/contents/{+path}","compare_url":"https://api.github.com/repos/jmmv/sandboxfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmmv/sandboxfs/merges","archive_url":"https://api.github.com/repos/jmmv/sandboxfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmmv/sandboxfs/downloads","issues_url":"https://api.github.com/repos/jmmv/sandboxfs/issues{/number}","pulls_url":"https://api.github.com/repos/jmmv/sandboxfs/pulls{/number}","milestones_url":"https://api.github.com/repos/jmmv/sandboxfs/milestones{/number}","notifications_url":"https://api.github.com/repos/jmmv/sandboxfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmmv/sandboxfs/labels{/name}","releases_url":"https://api.github.com/repos/jmmv/sandboxfs/releases{/id}","deployments_url":"https://api.github.com/repos/jmmv/sandboxfs/deployments","created_at":"2017-09-12T13:56:08Z","updated_at":"2017-09-12T13:56:09Z","pushed_at":"2018-02-16T20:23:07Z","git_url":"git://github.com/jmmv/sandboxfs.git","ssh_url":"git@github.com:jmmv/sandboxfs.git","clone_url":"https://github.com/jmmv/sandboxfs.git","svn_url":"https://github.com/jmmv/sandboxfs","homepage":"","size":287,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"aaa5afbab598759897a9a58a47d94d4516eb8ae1","user":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":101425662,"name":"sandboxfs","full_name":"bazelbuild/sandboxfs","owner":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazelbuild/sandboxfs","description":"A virtual file system for sandboxing","fork":false,"url":"https://api.github.com/repos/bazelbuild/sandboxfs","forks_url":"https://api.github.com/repos/bazelbuild/sandboxfs/forks","keys_url":"https://api.github.com/repos/bazelbuild/sandboxfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazelbuild/sandboxfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazelbuild/sandboxfs/teams","hooks_url":"https://api.github.com/repos/bazelbuild/sandboxfs/hooks","issue_events_url":"https://api.github.com/repos/bazelbuild/sandboxfs/issues/events{/number}","events_url":"https://api.github.com/repos/bazelbuild/sandboxfs/events","assignees_url":"https://api.github.com/repos/bazelbuild/sandboxfs/assignees{/user}","branches_url":"https://api.github.com/repos/bazelbuild/sandboxfs/branches{/branch}","tags_url":"https://api.github.com/repos/bazelbuild/sandboxfs/tags","blobs_url":"https://api.github.com/repos/bazelbuild/sandboxfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazelbuild/sandboxfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazelbuild/sandboxfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazelbuild/sandboxfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazelbuild/sandboxfs/statuses/{sha}","languages_url":"https://api.github.com/repos/bazelbuild/sandboxfs/languages","stargazers_url":"https://api.github.com/repos/bazelbuild/sandboxfs/stargazers","contributors_url":"https://api.github.com/repos/bazelbuild/sandboxfs/contributors","subscribers_url":"https://api.github.com/repos/bazelbuild/sandboxfs/subscribers","subscription_url":"https://api.github.com/repos/bazelbuild/sandboxfs/subscription","commits_url":"https://api.github.com/repos/bazelbuild/sandboxfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazelbuild/sandboxfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazelbuild/sandboxfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazelbuild/sandboxfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazelbuild/sandboxfs/contents/{+path}","compare_url":"https://api.github.com/repos/bazelbuild/sandboxfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazelbuild/sandboxfs/merges","archive_url":"https://api.github.com/repos/bazelbuild/sandboxfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazelbuild/sandboxfs/downloads","issues_url":"https://api.github.com/repos/bazelbuild/sandboxfs/issues{/number}","pulls_url":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls{/number}","milestones_url":"https://api.github.com/repos/bazelbuild/sandboxfs/milestones{/number}","notifications_url":"https://api.github.com/repos/bazelbuild/sandboxfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazelbuild/sandboxfs/labels{/name}","releases_url":"https://api.github.com/repos/bazelbuild/sandboxfs/releases{/id}","deployments_url":"https://api.github.com/repos/bazelbuild/sandboxfs/deployments","created_at":"2017-08-25T17:12:51Z","updated_at":"2018-02-19T02:37:59Z","pushed_at":"2018-02-16T20:23:04Z","git_url":"git://github.com/bazelbuild/sandboxfs.git","ssh_url":"git@github.com:bazelbuild/sandboxfs.git","clone_url":"https://github.com/bazelbuild/sandboxfs.git","svn_url":"https://github.com/bazelbuild/sandboxfs","homepage":"","size":268,"stargazers_count":48,"watchers_count":48,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":8,"open_issues":4,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14"},"html":{"href":"https://github.com/bazelbuild/sandboxfs/pull/14"},"issue":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/issues/14"},"comments":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/sandboxfs/statuses/71fe15eb3ec3548180728bf72d364741d92b085b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jmmv"}}