diff options
| author | Nigel Tao <nigeltao@golang.org> | 2015-05-20 13:24:58 +1000 |
|---|---|---|
| committer | Nigel Tao <nigeltao@golang.org> | 2015-05-27 04:39:39 +0000 |
| commit | 4d44a014ced4b854db2d13ad95888aa189cc9967 (patch) | |
| tree | 510e242f91241bc65e0b50cf6b26509603a77d15 /git-codereview/api.go | |
| parent | 6fe36b1731a93d7a2e092357415855e7e942d1c5 (diff) | |
| download | go-x-review-4d44a014ced4b854db2d13ad95888aa189cc9967.tar.xz | |
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>
Diffstat (limited to 'git-codereview/api.go')
| -rw-r--r-- | git-codereview/api.go | 8 |
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) |
