code: func ParseRepoURL(repoURL string) (host, project string, err error) {
  	var u *url.URL
  	u, err = url.Parse(repoURL)
  	switch {
  	case err != nil:
  		err = errors.Annotate(err, "invalid URL").Err()
  	case u.Scheme != "https":
  		err = errors.New("only https scheme is supported")
  	case !strings.HasSuffix(u.Host, ".googlesource.com"):
  		err = errors.New("only .googlesource.com repos are supported")
  	case strings.Contains(u.Path, "+"):
  		err = errors.New("repo URL path must not contain +")
  	case !strings.HasPrefix(u.Path, "/"):
  		err = errors.New("repo URL path must start with a slash")
  	case u.Path == "/":
  		err = errors.New("repo URL path must be not just a slash")
  	case u.RawQuery != "":
  		err = errors.New("repo URL must not have query")
  	case u.Fragment != "":
  		err = errors.New("repo URL must not have fragment")
  	default:
  		host = u.Host
  		if strings.HasPrefix(u.Path, "/a/") {
  			u.Path = strings.TrimPrefix(u.Path, "/a")
  		}
  		project = strings.Trim(u.Path, "/")
  		project = strings.TrimSuffix(project, ".git")
  	}
  	return
  }
docs: // ParseRepoURL parses a Gitiles repository URL.