aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'git-codereview/api.go')
-rw-r--r--git-codereview/api.go8
1 files changed, 6 insertions, 2 deletions
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 @@ func loadGerritOrigin() {
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)