aboutsummaryrefslogtreecommitdiff
path: root/git-codereview
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2018-06-05 17:08:39 -0400
committerMichael Matloob <matloob@golang.org>2018-06-05 21:14:28 +0000
commit0d7a66991c6e16602c02f2deda6f7b0908be4b7a (patch)
tree17e2e04669d87d06635dae8df7459b8cc7adf72f /git-codereview
parentd4998e72643e8f0b9edc1c6e63c8ba6fb2a2a949 (diff)
downloadgo-x-review-0d7a66991c6e16602c02f2deda6f7b0908be4b7a.tar.xz
git-codereview: check for https:// origin only for googlesource urls
Change-Id: Idc3ce48cb706959738c6045c3e58904399ca24f3 Reviewed-on: https://go-review.googlesource.com/116361 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'git-codereview')
-rw-r--r--git-codereview/api.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/git-codereview/api.go b/git-codereview/api.go
index c8f6da3..65bc3a2 100644
--- a/git-codereview/api.go
+++ b/git-codereview/api.go
@@ -73,11 +73,10 @@ func loadGerritOriginInternal(origin, remoteOrigin string) error {
return fmt.Errorf("git origin must be a Gerrit host, not GitHub: %s", origin)
}
- if !strings.HasPrefix(origin, "https://") {
- return fmt.Errorf("git origin must be an https:// URL: %s", origin)
- }
-
if googlesourceIndex := strings.Index(origin, ".googlesource.com"); googlesourceIndex >= 0 {
+ if !strings.HasPrefix(origin, "https://") {
+ return fmt.Errorf("git origin must be an https:// URL: %s", origin)
+ }
// https:// prefix and then one slash between host and top-level name
if strings.Count(origin, "/") != 3 {
return fmt.Errorf("git origin is malformed: %s", origin)