{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/source-to-image/pulls/comments/43466721","id":43466721,"diff_hunk":"@@ -62,18 +78,178 @@ func stringInSlice(s string, slice []string) bool {\n // ValidCloneSpec determines if the given string reference points to a valid git\n // repository\n func (h *stiGit) ValidCloneSpec(source string) bool {\n-\turl, err := url.Parse(source)\n+\t_, err := parseSpec(source, false)\n+\treturn err == nil\n+}\n+\n+// ValidCloneSpecRemoteOnly determines if the given string reference points to a valid remote git\n+// repository; valid local repository specs will result in a return of false\n+func (h *stiGit) ValidCloneSpecRemoteOnly(source string) bool {\n+\t_, err := parseSpec(source, true)\n+\treturn err == nil\n+}\n+\n+// MungeNoProtocolURL will take a URL returned from net/url.Parse and make\n+// corrections to the URL when no protocol is specified in the Scheme, where there\n+// are valid protocol-less git url spec formats that result in either file:// or ssh:// protocol usage;\n+// if an explicit protocol other than file:// or ssh:// are already specified in a valid way, then the\n+// URL is left unchaged and the method simply returns with no error reported,\n+// since the URL is\n+func (h *stiGit) MungeNoProtocolURL(source string, uri *url.URL) error {\n+\tif uri == nil {\n+\t\treturn nil\n+\t}\n+\n+\tjustReturn, validURL := schemeNecessitatesReturn(uri)\n+\tif justReturn {\n+\t\tif validURL {\n+\t\t\treturn nil\n+\t\t} else {\n+\t\t\terrors.New(fmt.Sprintf(\"this url is not supported for git cloning: %v\", uri))\n+\t\t}\n+\t}\n+\n+\tmods, err := parseSpec(source, false)\n \tif err != nil {\n-\t\treturn false\n+\t\treturn err\n+\t}\n+\t// don't modify the protocol options which always have to be explicitly specified (http, https,  git)\n+\tif uri.Scheme != \"ssh\" && uri.Scheme != \"file\" {\n+\t\treturn nil\n \t}\n \n-\tif stringInSlice(url.Scheme, allowedSchemes) {\n-\t\treturn true\n+\t// update the either file or ssh url accordingly\n+\tif len(mods.user) > 0 {\n+\t\turi.User = url.User(mods.user)\n+\t}\n+\tif len(mods.scheme) > 0 {\n+\t\turi.Scheme = mods.scheme\n+\t}\n+\tif len(mods.host) > 0 {\n+\t\turi.Host = mods.host\n+\t}\n+\tif len(mods.path) > 0 {\n+\t\turi.Path = mods.path\n+\t}\n+\tif len(mods.frag) > 0 {\n+\t\turi.Fragment = mods.frag\n+\t}\n+\treturn nil\n+}\n+\n+// schemeNeccessitatesReturn examines the URL and determines whether further","path":"pkg/scm/git/git.go","position":106,"original_position":106,"commit_id":"0bd2e9d5b7ba64fb0d238b069b84a3fb85bca747","original_commit_id":"0bd2e9d5b7ba64fb0d238b069b84a3fb85bca747","user":{"login":"gabemontero","id":3594868,"avatar_url":"https://avatars.githubusercontent.com/u/3594868?v=3","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"body":"i need new glasses :-)","created_at":"2015-10-30T02:28:11Z","updated_at":"2015-10-30T02:28:11Z","html_url":"https://github.com/openshift/source-to-image/pull/319#discussion_r43466721","pull_request_url":"https://api.github.com/repos/openshift/source-to-image/pulls/319","_links":{"self":{"href":"https://api.github.com/repos/openshift/source-to-image/pulls/comments/43466721"},"html":{"href":"https://github.com/openshift/source-to-image/pull/319#discussion_r43466721"},"pull_request":{"href":"https://api.github.com/repos/openshift/source-to-image/pulls/319"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/source-to-image/pulls/319","id":48736765,"html_url":"https://github.com/openshift/source-to-image/pull/319","diff_url":"https://github.com/openshift/source-to-image/pull/319.diff","patch_url":"https://github.com/openshift/source-to-image/pull/319.patch","issue_url":"https://api.github.com/repos/openshift/source-to-image/issues/319","number":319,"state":"open","locked":false,"title":"don't require .git suffix; consolidate validation, empty protocol URL processing","user":{"login":"gabemontero","id":3594868,"avatar_url":"https://avatars.githubusercontent.com/u/3594868?v=3","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"body":"@bparees @csrwng from email exchange this weekend and @csrwng heads up on Friday.  Also added a quick verification for bugzilla 1268478","created_at":"2015-10-26T13:10:28Z","updated_at":"2015-10-30T02:28:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d415beede07ae11dc60d9464f8b9cde9fb644ba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/source-to-image/pulls/319/commits","review_comments_url":"https://api.github.com/repos/openshift/source-to-image/pulls/319/comments","review_comment_url":"https://api.github.com/repos/openshift/source-to-image/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/source-to-image/issues/319/comments","statuses_url":"https://api.github.com/repos/openshift/source-to-image/statuses/0bd2e9d5b7ba64fb0d238b069b84a3fb85bca747","head":{"label":"gabemontero:dotgit","ref":"dotgit","sha":"0bd2e9d5b7ba64fb0d238b069b84a3fb85bca747","user":{"login":"gabemontero","id":3594868,"avatar_url":"https://avatars.githubusercontent.com/u/3594868?v=3","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"repo":{"id":36944033,"name":"source-to-image","full_name":"gabemontero/source-to-image","owner":{"login":"gabemontero","id":3594868,"avatar_url":"https://avatars.githubusercontent.com/u/3594868?v=3","gravatar_id":"","url":"https://api.github.com/users/gabemontero","html_url":"https://github.com/gabemontero","followers_url":"https://api.github.com/users/gabemontero/followers","following_url":"https://api.github.com/users/gabemontero/following{/other_user}","gists_url":"https://api.github.com/users/gabemontero/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemontero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemontero/subscriptions","organizations_url":"https://api.github.com/users/gabemontero/orgs","repos_url":"https://api.github.com/users/gabemontero/repos","events_url":"https://api.github.com/users/gabemontero/events{/privacy}","received_events_url":"https://api.github.com/users/gabemontero/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gabemontero/source-to-image","description":"A tool for building/building artifacts from source and injecting into docker images","fork":true,"url":"https://api.github.com/repos/gabemontero/source-to-image","forks_url":"https://api.github.com/repos/gabemontero/source-to-image/forks","keys_url":"https://api.github.com/repos/gabemontero/source-to-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gabemontero/source-to-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gabemontero/source-to-image/teams","hooks_url":"https://api.github.com/repos/gabemontero/source-to-image/hooks","issue_events_url":"https://api.github.com/repos/gabemontero/source-to-image/issues/events{/number}","events_url":"https://api.github.com/repos/gabemontero/source-to-image/events","assignees_url":"https://api.github.com/repos/gabemontero/source-to-image/assignees{/user}","branches_url":"https://api.github.com/repos/gabemontero/source-to-image/branches{/branch}","tags_url":"https://api.github.com/repos/gabemontero/source-to-image/tags","blobs_url":"https://api.github.com/repos/gabemontero/source-to-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gabemontero/source-to-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gabemontero/source-to-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/gabemontero/source-to-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gabemontero/source-to-image/statuses/{sha}","languages_url":"https://api.github.com/repos/gabemontero/source-to-image/languages","stargazers_url":"https://api.github.com/repos/gabemontero/source-to-image/stargazers","contributors_url":"https://api.github.com/repos/gabemontero/source-to-image/contributors","subscribers_url":"https://api.github.com/repos/gabemontero/source-to-image/subscribers","subscription_url":"https://api.github.com/repos/gabemontero/source-to-image/subscription","commits_url":"https://api.github.com/repos/gabemontero/source-to-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/gabemontero/source-to-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/gabemontero/source-to-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/gabemontero/source-to-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/gabemontero/source-to-image/contents/{+path}","compare_url":"https://api.github.com/repos/gabemontero/source-to-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gabemontero/source-to-image/merges","archive_url":"https://api.github.com/repos/gabemontero/source-to-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gabemontero/source-to-image/downloads","issues_url":"https://api.github.com/repos/gabemontero/source-to-image/issues{/number}","pulls_url":"https://api.github.com/repos/gabemontero/source-to-image/pulls{/number}","milestones_url":"https://api.github.com/repos/gabemontero/source-to-image/milestones{/number}","notifications_url":"https://api.github.com/repos/gabemontero/source-to-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gabemontero/source-to-image/labels{/name}","releases_url":"https://api.github.com/repos/gabemontero/source-to-image/releases{/id}","created_at":"2015-06-05T16:49:12Z","updated_at":"2015-06-05T16:49:12Z","pushed_at":"2015-10-29T17:39:55Z","git_url":"git://github.com/gabemontero/source-to-image.git","ssh_url":"git@github.com:gabemontero/source-to-image.git","clone_url":"https://github.com/gabemontero/source-to-image.git","svn_url":"https://github.com/gabemontero/source-to-image","homepage":"","size":1428,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"openshift:master","ref":"master","sha":"9728b53c11218598acb2cc1b9c8cc762c36f44bc","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":16323162,"name":"source-to-image","full_name":"openshift/source-to-image","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/source-to-image","description":"A tool for building/building artifacts from source and injecting into docker images","fork":false,"url":"https://api.github.com/repos/openshift/source-to-image","forks_url":"https://api.github.com/repos/openshift/source-to-image/forks","keys_url":"https://api.github.com/repos/openshift/source-to-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/source-to-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/source-to-image/teams","hooks_url":"https://api.github.com/repos/openshift/source-to-image/hooks","issue_events_url":"https://api.github.com/repos/openshift/source-to-image/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/source-to-image/events","assignees_url":"https://api.github.com/repos/openshift/source-to-image/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/source-to-image/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/source-to-image/tags","blobs_url":"https://api.github.com/repos/openshift/source-to-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/source-to-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/source-to-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/source-to-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/source-to-image/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/source-to-image/languages","stargazers_url":"https://api.github.com/repos/openshift/source-to-image/stargazers","contributors_url":"https://api.github.com/repos/openshift/source-to-image/contributors","subscribers_url":"https://api.github.com/repos/openshift/source-to-image/subscribers","subscription_url":"https://api.github.com/repos/openshift/source-to-image/subscription","commits_url":"https://api.github.com/repos/openshift/source-to-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/source-to-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/source-to-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/source-to-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/source-to-image/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/source-to-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/source-to-image/merges","archive_url":"https://api.github.com/repos/openshift/source-to-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/source-to-image/downloads","issues_url":"https://api.github.com/repos/openshift/source-to-image/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/source-to-image/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/source-to-image/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/source-to-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/source-to-image/labels{/name}","releases_url":"https://api.github.com/repos/openshift/source-to-image/releases{/id}","created_at":"2014-01-28T19:32:40Z","updated_at":"2015-10-28T20:20:43Z","pushed_at":"2015-10-29T22:08:54Z","git_url":"git://github.com/openshift/source-to-image.git","ssh_url":"git@github.com:openshift/source-to-image.git","clone_url":"https://github.com/openshift/source-to-image.git","svn_url":"https://github.com/openshift/source-to-image","homepage":"","size":2862,"stargazers_count":144,"watchers_count":144,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":24,"forks":67,"open_issues":24,"watchers":144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/source-to-image/pulls/319"},"html":{"href":"https://github.com/openshift/source-to-image/pull/319"},"issue":{"href":"https://api.github.com/repos/openshift/source-to-image/issues/319"},"comments":{"href":"https://api.github.com/repos/openshift/source-to-image/issues/319/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/source-to-image/pulls/319/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/source-to-image/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/source-to-image/pulls/319/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/source-to-image/statuses/0bd2e9d5b7ba64fb0d238b069b84a3fb85bca747"}}}}