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>
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 @@
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)