{"action":"created","comment":{"url":"https://api.github.com/repos/danielpclark/faster_path/pulls/comments/174342748","pull_request_review_id":103680411,"id":174342748,"diff_hunk":"@@ -20,15 +20,88 @@ pub fn basename<'a>(path: &'a str, ext: &str) -> &'a str {\n       left = last_slash_pos + 1;\n     }\n   }\n+  &path[left..left + ext_end(&bytes[left..right], ext)]\n+}\n+\n+fn ext_end(slice: &[u8], ext: &str) -> usize {\n+  if ext.len() >= slice.len() || slice == b\".\" || slice == b\"..\" {\n+    return slice.len();\n+  }\n   let ext_bytes = ext.as_bytes();\n+  // TODO: Implement other ext patterns (see the ignored test below).\n   if ext_bytes == b\".*\" {\n-    if let Some(dot_pos) = find_last_dot_pos(&bytes[left..right]) {\n-      right = left + dot_pos;\n+    if let Some(dot_pos) = find_last_dot_pos(slice) {\n+      return dot_pos;\n     }\n-  } else if bytes[left..right].ends_with(ext_bytes) {\n-    right -= ext_bytes.len();\n+  } else if slice.ends_with(ext_bytes) {\n+    return slice.len() - ext_bytes.len();\n   }\n-  &path[left..right]\n+  slice.len()\n+}\n+\n+// TODO: Un-ignore once the functionality has been implemented.","path":"src/basename.rs","position":28,"original_position":28,"commit_id":"7876d36d5f64dd955b8142fc1fa560907bc7a868","original_commit_id":"7876d36d5f64dd955b8142fc1fa560907bc7a868","user":{"login":"glebm","id":216339,"avatar_url":"https://avatars0.githubusercontent.com/u/216339?v=4","gravatar_id":"","url":"https://api.github.com/users/glebm","html_url":"https://github.com/glebm","followers_url":"https://api.github.com/users/glebm/followers","following_url":"https://api.github.com/users/glebm/following{/other_user}","gists_url":"https://api.github.com/users/glebm/gists{/gist_id}","starred_url":"https://api.github.com/users/glebm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glebm/subscriptions","organizations_url":"https://api.github.com/users/glebm/orgs","repos_url":"https://api.github.com/users/glebm/repos","events_url":"https://api.github.com/users/glebm/events{/privacy}","received_events_url":"https://api.github.com/users/glebm/received_events","type":"User","site_admin":false},"body":"That's true, but code may still rely on this undocumented behaviour.\r\nI've figured out an easy way to match Ruby exactly here, will send in a moment.","created_at":"2018-03-14T03:08:58Z","updated_at":"2018-03-14T03:08:58Z","html_url":"https://github.com/danielpclark/faster_path/pull/164#discussion_r174342748","pull_request_url":"https://api.github.com/repos/danielpclark/faster_path/pulls/164","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/danielpclark/faster_path/pulls/comments/174342748"},"html":{"href":"https://github.com/danielpclark/faster_path/pull/164#discussion_r174342748"},"pull_request":{"href":"https://api.github.com/repos/danielpclark/faster_path/pulls/164"}},"in_reply_to_id":174341941},"pull_request":{"url":"https://api.github.com/repos/danielpclark/faster_path/pulls/164","id":174839752,"html_url":"https://github.com/danielpclark/faster_path/pull/164","diff_url":"https://github.com/danielpclark/faster_path/pull/164.diff","patch_url":"https://github.com/danielpclark/faster_path/pull/164.patch","issue_url":"https://api.github.com/repos/danielpclark/faster_path/issues/164","number":164,"state":"open","locked":false,"title":"Fixes the basename .. bug","user":{"login":"glebm","id":216339,"avatar_url":"https://avatars0.githubusercontent.com/u/216339?v=4","gravatar_id":"","url":"https://api.github.com/users/glebm","html_url":"https://github.com/glebm","followers_url":"https://api.github.com/users/glebm/followers","following_url":"https://api.github.com/users/glebm/following{/other_user}","gists_url":"https://api.github.com/users/glebm/gists{/gist_id}","starred_url":"https://api.github.com/users/glebm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glebm/subscriptions","organizations_url":"https://api.github.com/users/glebm/orgs","repos_url":"https://api.github.com/users/glebm/repos","events_url":"https://api.github.com/users/glebm/events{/privacy}","received_events_url":"https://api.github.com/users/glebm/received_events","type":"User","site_admin":false},"body":"Fixes #162 \r\n\r\nThis incorporates all the Rust tests added by @danielpclark's in #163 and adds a few more. There does not seem to be any noticable performance impact.","created_at":"2018-03-14T02:35:59Z","updated_at":"2018-03-14T03:08:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ab975dc08675c18262d14180f625b45a62eb1bd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/danielpclark/faster_path/pulls/164/commits","review_comments_url":"https://api.github.com/repos/danielpclark/faster_path/pulls/164/comments","review_comment_url":"https://api.github.com/repos/danielpclark/faster_path/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danielpclark/faster_path/issues/164/comments","statuses_url":"https://api.github.com/repos/danielpclark/faster_path/statuses/7876d36d5f64dd955b8142fc1fa560907bc7a868","head":{"label":"glebm:fix-basename","ref":"fix-basename","sha":"7876d36d5f64dd955b8142fc1fa560907bc7a868","user":{"login":"glebm","id":216339,"avatar_url":"https://avatars0.githubusercontent.com/u/216339?v=4","gravatar_id":"","url":"https://api.github.com/users/glebm","html_url":"https://github.com/glebm","followers_url":"https://api.github.com/users/glebm/followers","following_url":"https://api.github.com/users/glebm/following{/other_user}","gists_url":"https://api.github.com/users/glebm/gists{/gist_id}","starred_url":"https://api.github.com/users/glebm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glebm/subscriptions","organizations_url":"https://api.github.com/users/glebm/orgs","repos_url":"https://api.github.com/users/glebm/repos","events_url":"https://api.github.com/users/glebm/events{/privacy}","received_events_url":"https://api.github.com/users/glebm/received_events","type":"User","site_admin":false},"repo":{"id":61502095,"name":"faster_path","full_name":"glebm/faster_path","owner":{"login":"glebm","id":216339,"avatar_url":"https://avatars0.githubusercontent.com/u/216339?v=4","gravatar_id":"","url":"https://api.github.com/users/glebm","html_url":"https://github.com/glebm","followers_url":"https://api.github.com/users/glebm/followers","following_url":"https://api.github.com/users/glebm/following{/other_user}","gists_url":"https://api.github.com/users/glebm/gists{/gist_id}","starred_url":"https://api.github.com/users/glebm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glebm/subscriptions","organizations_url":"https://api.github.com/users/glebm/orgs","repos_url":"https://api.github.com/users/glebm/repos","events_url":"https://api.github.com/users/glebm/events{/privacy}","received_events_url":"https://api.github.com/users/glebm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glebm/faster_path","description":"Faster Pathname handling for Ruby written in Rust","fork":true,"url":"https://api.github.com/repos/glebm/faster_path","forks_url":"https://api.github.com/repos/glebm/faster_path/forks","keys_url":"https://api.github.com/repos/glebm/faster_path/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glebm/faster_path/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glebm/faster_path/teams","hooks_url":"https://api.github.com/repos/glebm/faster_path/hooks","issue_events_url":"https://api.github.com/repos/glebm/faster_path/issues/events{/number}","events_url":"https://api.github.com/repos/glebm/faster_path/events","assignees_url":"https://api.github.com/repos/glebm/faster_path/assignees{/user}","branches_url":"https://api.github.com/repos/glebm/faster_path/branches{/branch}","tags_url":"https://api.github.com/repos/glebm/faster_path/tags","blobs_url":"https://api.github.com/repos/glebm/faster_path/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glebm/faster_path/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glebm/faster_path/git/refs{/sha}","trees_url":"https://api.github.com/repos/glebm/faster_path/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glebm/faster_path/statuses/{sha}","languages_url":"https://api.github.com/repos/glebm/faster_path/languages","stargazers_url":"https://api.github.com/repos/glebm/faster_path/stargazers","contributors_url":"https://api.github.com/repos/glebm/faster_path/contributors","subscribers_url":"https://api.github.com/repos/glebm/faster_path/subscribers","subscription_url":"https://api.github.com/repos/glebm/faster_path/subscription","commits_url":"https://api.github.com/repos/glebm/faster_path/commits{/sha}","git_commits_url":"https://api.github.com/repos/glebm/faster_path/git/commits{/sha}","comments_url":"https://api.github.com/repos/glebm/faster_path/comments{/number}","issue_comment_url":"https://api.github.com/repos/glebm/faster_path/issues/comments{/number}","contents_url":"https://api.github.com/repos/glebm/faster_path/contents/{+path}","compare_url":"https://api.github.com/repos/glebm/faster_path/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glebm/faster_path/merges","archive_url":"https://api.github.com/repos/glebm/faster_path/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glebm/faster_path/downloads","issues_url":"https://api.github.com/repos/glebm/faster_path/issues{/number}","pulls_url":"https://api.github.com/repos/glebm/faster_path/pulls{/number}","milestones_url":"https://api.github.com/repos/glebm/faster_path/milestones{/number}","notifications_url":"https://api.github.com/repos/glebm/faster_path/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glebm/faster_path/labels{/name}","releases_url":"https://api.github.com/repos/glebm/faster_path/releases{/id}","deployments_url":"https://api.github.com/repos/glebm/faster_path/deployments","created_at":"2016-06-19T21:51:50Z","updated_at":"2016-06-19T21:51:51Z","pushed_at":"2018-03-14T02:56:02Z","git_url":"git://github.com/glebm/faster_path.git","ssh_url":"git@github.com:glebm/faster_path.git","clone_url":"https://github.com/glebm/faster_path.git","svn_url":"https://github.com/glebm/faster_path","homepage":"","size":1188,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"danielpclark:master","ref":"master","sha":"3f40f1868fa347d9ba272aef180aabe37f040046","user":{"login":"danielpclark","id":319081,"avatar_url":"https://avatars1.githubusercontent.com/u/319081?v=4","gravatar_id":"","url":"https://api.github.com/users/danielpclark","html_url":"https://github.com/danielpclark","followers_url":"https://api.github.com/users/danielpclark/followers","following_url":"https://api.github.com/users/danielpclark/following{/other_user}","gists_url":"https://api.github.com/users/danielpclark/gists{/gist_id}","starred_url":"https://api.github.com/users/danielpclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielpclark/subscriptions","organizations_url":"https://api.github.com/users/danielpclark/orgs","repos_url":"https://api.github.com/users/danielpclark/repos","events_url":"https://api.github.com/users/danielpclark/events{/privacy}","received_events_url":"https://api.github.com/users/danielpclark/received_events","type":"User","site_admin":false},"repo":{"id":60771060,"name":"faster_path","full_name":"danielpclark/faster_path","owner":{"login":"danielpclark","id":319081,"avatar_url":"https://avatars1.githubusercontent.com/u/319081?v=4","gravatar_id":"","url":"https://api.github.com/users/danielpclark","html_url":"https://github.com/danielpclark","followers_url":"https://api.github.com/users/danielpclark/followers","following_url":"https://api.github.com/users/danielpclark/following{/other_user}","gists_url":"https://api.github.com/users/danielpclark/gists{/gist_id}","starred_url":"https://api.github.com/users/danielpclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielpclark/subscriptions","organizations_url":"https://api.github.com/users/danielpclark/orgs","repos_url":"https://api.github.com/users/danielpclark/repos","events_url":"https://api.github.com/users/danielpclark/events{/privacy}","received_events_url":"https://api.github.com/users/danielpclark/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielpclark/faster_path","description":"Faster Pathname handling for Ruby written in Rust","fork":false,"url":"https://api.github.com/repos/danielpclark/faster_path","forks_url":"https://api.github.com/repos/danielpclark/faster_path/forks","keys_url":"https://api.github.com/repos/danielpclark/faster_path/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielpclark/faster_path/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielpclark/faster_path/teams","hooks_url":"https://api.github.com/repos/danielpclark/faster_path/hooks","issue_events_url":"https://api.github.com/repos/danielpclark/faster_path/issues/events{/number}","events_url":"https://api.github.com/repos/danielpclark/faster_path/events","assignees_url":"https://api.github.com/repos/danielpclark/faster_path/assignees{/user}","branches_url":"https://api.github.com/repos/danielpclark/faster_path/branches{/branch}","tags_url":"https://api.github.com/repos/danielpclark/faster_path/tags","blobs_url":"https://api.github.com/repos/danielpclark/faster_path/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielpclark/faster_path/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielpclark/faster_path/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielpclark/faster_path/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielpclark/faster_path/statuses/{sha}","languages_url":"https://api.github.com/repos/danielpclark/faster_path/languages","stargazers_url":"https://api.github.com/repos/danielpclark/faster_path/stargazers","contributors_url":"https://api.github.com/repos/danielpclark/faster_path/contributors","subscribers_url":"https://api.github.com/repos/danielpclark/faster_path/subscribers","subscription_url":"https://api.github.com/repos/danielpclark/faster_path/subscription","commits_url":"https://api.github.com/repos/danielpclark/faster_path/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielpclark/faster_path/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielpclark/faster_path/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielpclark/faster_path/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielpclark/faster_path/contents/{+path}","compare_url":"https://api.github.com/repos/danielpclark/faster_path/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielpclark/faster_path/merges","archive_url":"https://api.github.com/repos/danielpclark/faster_path/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielpclark/faster_path/downloads","issues_url":"https://api.github.com/repos/danielpclark/faster_path/issues{/number}","pulls_url":"https://api.github.com/repos/danielpclark/faster_path/pulls{/number}","milestones_url":"https://api.github.com/repos/danielpclark/faster_path/milestones{/number}","notifications_url":"https://api.github.com/repos/danielpclark/faster_path/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielpclark/faster_path/labels{/name}","releases_url":"https://api.github.com/repos/danielpclark/faster_path/releases{/id}","deployments_url":"https://api.github.com/repos/danielpclark/faster_path/deployments","created_at":"2016-06-09T11:51:40Z","updated_at":"2018-03-14T01:57:05Z","pushed_at":"2018-03-14T02:56:03Z","git_url":"git://github.com/danielpclark/faster_path.git","ssh_url":"git@github.com:danielpclark/faster_path.git","clone_url":"https://github.com/danielpclark/faster_path.git","svn_url":"https://github.com/danielpclark/faster_path","homepage":"","size":1195,"stargazers_count":695,"watchers_count":695,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":27,"open_issues":12,"watchers":695,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danielpclark/faster_path/pulls/164"},"html":{"href":"https://github.com/danielpclark/faster_path/pull/164"},"issue":{"href":"https://api.github.com/repos/danielpclark/faster_path/issues/164"},"comments":{"href":"https://api.github.com/repos/danielpclark/faster_path/issues/164/comments"},"review_comments":{"href":"https://api.github.com/repos/danielpclark/faster_path/pulls/164/comments"},"review_comment":{"href":"https://api.github.com/repos/danielpclark/faster_path/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danielpclark/faster_path/pulls/164/commits"},"statuses":{"href":"https://api.github.com/repos/danielpclark/faster_path/statuses/7876d36d5f64dd955b8142fc1fa560907bc7a868"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"glebm"}}