{"action":"created","comment":{"url":"https://api.github.com/repos/sourcegraph/srclib/pulls/comments/31823848","id":31823848,"diff_hunk":"@@ -33,6 +33,14 @@ func TryMakeURI(cloneURL string) (string, error) {\n \turl, err := url.Parse(cloneURL)\n \tif err != nil {\n \t\treturn \"\", fmt.Errorf(\"MakeURI(%q): %s\", cloneURL, err)\n+\t} else if url.Path == \"\" || url.Path == \"/\" {\n+\t\treturn \"\", fmt.Errorf(\"MakeURI(%q): missing path from URL\", cloneURL)\n+\t} else if url.Host == \"\" && !strings.Contains(strings.Split(url.Path, \"/\")[0], \".\") {\n+\t\t// We ensure our Path doesn't look like the output of TryMakeURI\n+\t\t// so that the output of this function is a fixed point.\n+\t\t// ie TryMakeURI(\"github.com/user/repo\") == (\"github.com/user/repo\", nil),\n+\t\t// not an error.\n+\t\treturn \"\", fmt.Errorf(\"MakeURI(%q): missing host from URL\", cloneURL)","path":"graph/repo.go","position":11,"original_position":11,"commit_id":"d68e144c206f7184b3ffa4eb8aa5b8deac810909","original_commit_id":"d68e144c206f7184b3ffa4eb8aa5b8deac810909","user":{"login":"sqs","id":1976,"avatar_url":"https://avatars.githubusercontent.com/u/1976?v=3","gravatar_id":"","url":"https://api.github.com/users/sqs","html_url":"https://github.com/sqs","followers_url":"https://api.github.com/users/sqs/followers","following_url":"https://api.github.com/users/sqs/following{/other_user}","gists_url":"https://api.github.com/users/sqs/gists{/gist_id}","starred_url":"https://api.github.com/users/sqs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqs/subscriptions","organizations_url":"https://api.github.com/users/sqs/orgs","repos_url":"https://api.github.com/users/sqs/repos","events_url":"https://api.github.com/users/sqs/events{/privacy}","received_events_url":"https://api.github.com/users/sqs/received_events","type":"User","site_admin":false},"body":"These errors may be displayed to the user. If the user is not familiar with the code (or doesn't have access to it--e.g., they only have a binary), then the `MakeURI(%q):` prefix will be confusing and not-helpful. I would suggest just using error messages like `missing host from URL (%q)` (or `determining URI from repo clone URL failed: missing host from URL (%q)`) here and just passing through the error on line 35.\r\n","created_at":"2015-06-05T15:42:22Z","updated_at":"2015-06-05T15:42:22Z","html_url":"https://github.com/sourcegraph/srclib/pull/158#discussion_r31823848","pull_request_url":"https://api.github.com/repos/sourcegraph/srclib/pulls/158","_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/srclib/pulls/comments/31823848"},"html":{"href":"https://github.com/sourcegraph/srclib/pull/158#discussion_r31823848"},"pull_request":{"href":"https://api.github.com/repos/sourcegraph/srclib/pulls/158"}}},"pull_request":{"url":"https://api.github.com/repos/sourcegraph/srclib/pulls/158","id":37042100,"html_url":"https://github.com/sourcegraph/srclib/pull/158","diff_url":"https://github.com/sourcegraph/srclib/pull/158.diff","patch_url":"https://github.com/sourcegraph/srclib/pull/158.patch","issue_url":"https://api.github.com/repos/sourcegraph/srclib/issues/158","number":158,"state":"open","locked":false,"title":"graph: Handle file paths passed to `TryMakeURI`","user":{"login":"keegancsmith","id":187831,"avatar_url":"https://avatars.githubusercontent.com/u/187831?v=3","gravatar_id":"","url":"https://api.github.com/users/keegancsmith","html_url":"https://github.com/keegancsmith","followers_url":"https://api.github.com/users/keegancsmith/followers","following_url":"https://api.github.com/users/keegancsmith/following{/other_user}","gists_url":"https://api.github.com/users/keegancsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/keegancsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keegancsmith/subscriptions","organizations_url":"https://api.github.com/users/keegancsmith/orgs","repos_url":"https://api.github.com/users/keegancsmith/repos","events_url":"https://api.github.com/users/keegancsmith/events{/privacy}","received_events_url":"https://api.github.com/users/keegancsmith/received_events","type":"User","site_admin":false},"body":"If a user clones a local repo with `git clone /path/to/repo /path/to/destrepo` the remote URL is a path `/path/to/destrepo`. We didn't error out from `TryMakeURI` on these inputs.","created_at":"2015-06-05T15:28:47Z","updated_at":"2015-06-05T15:42:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"785d875714e2cd9736f17aee5016028e3e091d51","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sourcegraph/srclib/pulls/158/commits","review_comments_url":"https://api.github.com/repos/sourcegraph/srclib/pulls/158/comments","review_comment_url":"https://api.github.com/repos/sourcegraph/srclib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sourcegraph/srclib/issues/158/comments","statuses_url":"https://api.github.com/repos/sourcegraph/srclib/statuses/d68e144c206f7184b3ffa4eb8aa5b8deac810909","head":{"label":"keegancsmith:nodb","ref":"nodb","sha":"d68e144c206f7184b3ffa4eb8aa5b8deac810909","user":{"login":"keegancsmith","id":187831,"avatar_url":"https://avatars.githubusercontent.com/u/187831?v=3","gravatar_id":"","url":"https://api.github.com/users/keegancsmith","html_url":"https://github.com/keegancsmith","followers_url":"https://api.github.com/users/keegancsmith/followers","following_url":"https://api.github.com/users/keegancsmith/following{/other_user}","gists_url":"https://api.github.com/users/keegancsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/keegancsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keegancsmith/subscriptions","organizations_url":"https://api.github.com/users/keegancsmith/orgs","repos_url":"https://api.github.com/users/keegancsmith/repos","events_url":"https://api.github.com/users/keegancsmith/events{/privacy}","received_events_url":"https://api.github.com/users/keegancsmith/received_events","type":"User","site_admin":false},"repo":{"id":36021388,"name":"srclib","full_name":"keegancsmith/srclib","owner":{"login":"keegancsmith","id":187831,"avatar_url":"https://avatars.githubusercontent.com/u/187831?v=3","gravatar_id":"","url":"https://api.github.com/users/keegancsmith","html_url":"https://github.com/keegancsmith","followers_url":"https://api.github.com/users/keegancsmith/followers","following_url":"https://api.github.com/users/keegancsmith/following{/other_user}","gists_url":"https://api.github.com/users/keegancsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/keegancsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keegancsmith/subscriptions","organizations_url":"https://api.github.com/users/keegancsmith/orgs","repos_url":"https://api.github.com/users/keegancsmith/repos","events_url":"https://api.github.com/users/keegancsmith/events{/privacy}","received_events_url":"https://api.github.com/users/keegancsmith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/keegancsmith/srclib","description":"srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go, Java, Python, JavaScript, Ruby, and Haskell) with a common output format, and developer tools (such as editor plugins) that consume this format.","fork":true,"url":"https://api.github.com/repos/keegancsmith/srclib","forks_url":"https://api.github.com/repos/keegancsmith/srclib/forks","keys_url":"https://api.github.com/repos/keegancsmith/srclib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keegancsmith/srclib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keegancsmith/srclib/teams","hooks_url":"https://api.github.com/repos/keegancsmith/srclib/hooks","issue_events_url":"https://api.github.com/repos/keegancsmith/srclib/issues/events{/number}","events_url":"https://api.github.com/repos/keegancsmith/srclib/events","assignees_url":"https://api.github.com/repos/keegancsmith/srclib/assignees{/user}","branches_url":"https://api.github.com/repos/keegancsmith/srclib/branches{/branch}","tags_url":"https://api.github.com/repos/keegancsmith/srclib/tags","blobs_url":"https://api.github.com/repos/keegancsmith/srclib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keegancsmith/srclib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keegancsmith/srclib/git/refs{/sha}","trees_url":"https://api.github.com/repos/keegancsmith/srclib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keegancsmith/srclib/statuses/{sha}","languages_url":"https://api.github.com/repos/keegancsmith/srclib/languages","stargazers_url":"https://api.github.com/repos/keegancsmith/srclib/stargazers","contributors_url":"https://api.github.com/repos/keegancsmith/srclib/contributors","subscribers_url":"https://api.github.com/repos/keegancsmith/srclib/subscribers","subscription_url":"https://api.github.com/repos/keegancsmith/srclib/subscription","commits_url":"https://api.github.com/repos/keegancsmith/srclib/commits{/sha}","git_commits_url":"https://api.github.com/repos/keegancsmith/srclib/git/commits{/sha}","comments_url":"https://api.github.com/repos/keegancsmith/srclib/comments{/number}","issue_comment_url":"https://api.github.com/repos/keegancsmith/srclib/issues/comments{/number}","contents_url":"https://api.github.com/repos/keegancsmith/srclib/contents/{+path}","compare_url":"https://api.github.com/repos/keegancsmith/srclib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keegancsmith/srclib/merges","archive_url":"https://api.github.com/repos/keegancsmith/srclib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keegancsmith/srclib/downloads","issues_url":"https://api.github.com/repos/keegancsmith/srclib/issues{/number}","pulls_url":"https://api.github.com/repos/keegancsmith/srclib/pulls{/number}","milestones_url":"https://api.github.com/repos/keegancsmith/srclib/milestones{/number}","notifications_url":"https://api.github.com/repos/keegancsmith/srclib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keegancsmith/srclib/labels{/name}","releases_url":"https://api.github.com/repos/keegancsmith/srclib/releases{/id}","created_at":"2015-05-21T15:36:15Z","updated_at":"2015-05-21T15:36:16Z","pushed_at":"2015-06-05T15:26:03Z","git_url":"git://github.com/keegancsmith/srclib.git","ssh_url":"git@github.com:keegancsmith/srclib.git","clone_url":"https://github.com/keegancsmith/srclib.git","svn_url":"https://github.com/keegancsmith/srclib","homepage":"https://srclib.org","size":3903,"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":"sourcegraph:nodb","ref":"nodb","sha":"88fb0df0918262852bf787e2c9be1c3f9d5d7c35","user":{"login":"sourcegraph","id":3979584,"avatar_url":"https://avatars.githubusercontent.com/u/3979584?v=3","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":22002058,"name":"srclib","full_name":"sourcegraph/srclib","owner":{"login":"sourcegraph","id":3979584,"avatar_url":"https://avatars.githubusercontent.com/u/3979584?v=3","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sourcegraph/srclib","description":"srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go, Java, Python, JavaScript, Ruby, and Haskell) with a common output format, and developer tools (such as editor plugins) that consume this format.","fork":false,"url":"https://api.github.com/repos/sourcegraph/srclib","forks_url":"https://api.github.com/repos/sourcegraph/srclib/forks","keys_url":"https://api.github.com/repos/sourcegraph/srclib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/srclib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/srclib/teams","hooks_url":"https://api.github.com/repos/sourcegraph/srclib/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/srclib/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/srclib/events","assignees_url":"https://api.github.com/repos/sourcegraph/srclib/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/srclib/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/srclib/tags","blobs_url":"https://api.github.com/repos/sourcegraph/srclib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/srclib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/srclib/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/srclib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/srclib/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/srclib/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/srclib/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/srclib/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/srclib/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/srclib/subscription","commits_url":"https://api.github.com/repos/sourcegraph/srclib/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/srclib/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/srclib/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/srclib/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/srclib/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/srclib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/srclib/merges","archive_url":"https://api.github.com/repos/sourcegraph/srclib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/srclib/downloads","issues_url":"https://api.github.com/repos/sourcegraph/srclib/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/srclib/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/srclib/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/srclib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/srclib/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/srclib/releases{/id}","created_at":"2014-07-19T04:38:41Z","updated_at":"2015-06-03T14:50:06Z","pushed_at":"2015-06-05T15:28:48Z","git_url":"git://github.com/sourcegraph/srclib.git","ssh_url":"git@github.com:sourcegraph/srclib.git","clone_url":"https://github.com/sourcegraph/srclib.git","svn_url":"https://github.com/sourcegraph/srclib","homepage":"https://srclib.org","size":7035,"stargazers_count":641,"watchers_count":641,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":42,"forks":30,"open_issues":42,"watchers":641,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/srclib/pulls/158"},"html":{"href":"https://github.com/sourcegraph/srclib/pull/158"},"issue":{"href":"https://api.github.com/repos/sourcegraph/srclib/issues/158"},"comments":{"href":"https://api.github.com/repos/sourcegraph/srclib/issues/158/comments"},"review_comments":{"href":"https://api.github.com/repos/sourcegraph/srclib/pulls/158/comments"},"review_comment":{"href":"https://api.github.com/repos/sourcegraph/srclib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sourcegraph/srclib/pulls/158/commits"},"statuses":{"href":"https://api.github.com/repos/sourcegraph/srclib/statuses/d68e144c206f7184b3ffa4eb8aa5b8deac810909"}}}}