git-codereview: improve haveGerritInternal

Use url.Parse and check URL components rather than performing imprecise
string matching. This addresses a bug where git-codereview does not work
when the Git origin ends with a forward slash.

Note that the check for '' has been removed since the test for
'' already excludes it.

Change-Id: I083bccdbacf2152cbfddd2407fb20afa47c8e91e
Reviewed-by: Carlos Amedee <>
LUCI-TryBot-Result: Go LUCI <>
Reviewed-by: Dmitri Shuralyov <>
TryBot-Result: Gopher Robot <>
Reviewed-by: Dmitri Shuralyov <>
Auto-Submit: Dmitri Shuralyov <>
Run-TryBot: Joel Sing <>
2 files changed
tree: bb7a19b85a177d261ff47a4fc2be127fac53389c
  1. git-codereview/
  2. .gitattributes
  3. codereview.cfg
  5. go.mod


The git-codereview tool is a command-line tool for working with Gerrit.


The easiest way to install is to run go install You can also manually git clone the repository to $GOPATH/src/

Run git codereview hooks to install Gerrit hooks for your git repository.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see

The main issue tracker for the review repository is located at Prefix your issue with “x/review:” in the subject line, so it is easy to find.