git-codereview: let codereview.cfg provide "gerrit".

Change-Id: I3b89b07dd8bb144dbfd3e502c280ed1be2f258a3
Reviewed-on: https://go-review.googlesource.com/10246
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/git-codereview/api.go b/git-codereview/api.go
index 0e8bc13..6fbdd48 100644
--- a/git-codereview/api.go
+++ b/git-codereview/api.go
@@ -40,8 +40,12 @@
 		return
 	}
 
-	// Gerrit must be set as Git's origin remote.
-	origin := trim(cmdOutput("git", "config", "remote.origin.url"))
+	// Gerrit must be set, either explicitly via the code review config or
+	// implicitly as Git's origin remote.
+	origin := config()["gerrit"]
+	if origin == "" {
+		origin = trim(cmdOutput("git", "config", "remote.origin.url"))
+	}
 
 	if strings.Contains(origin, "github.com") {
 		dief("git origin must be a Gerrit host, not GitHub: %s", origin)