diff options
| author | Benny Siegert <bsiegert@google.com> | 2022-10-13 20:18:34 +0200 |
|---|---|---|
| committer | Benny Siegert <bsiegert@gmail.com> | 2022-11-01 17:36:02 +0000 |
| commit | 197006278d6bfe1d37a22f19be41ed573d66796d (patch) | |
| tree | 919dec9b688462ef4391b5366abd05ed8a2d4b84 | |
| parent | a897dc9c03c577746ba0a4033dc61f3e5983f3e2 (diff) | |
| download | go-x-review-197006278d6bfe1d37a22f19be41ed573d66796d.tar.xz | |
git-codereview: allow trailing slash in git originv1.2.0
An origin like "https://go.googlesource.com/build/" should also work.
Perhaps this should use net/url instead of parsing URLs by hand.
Change-Id: I5304324ae67c054b8377d500ecafe46b296d1531
Reviewed-on: https://go-review.googlesource.com/c/review/+/442875
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
| -rw-r--r-- | git-codereview/api.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/git-codereview/api.go b/git-codereview/api.go index 7a0da55..947369a 100644 --- a/git-codereview/api.go +++ b/git-codereview/api.go @@ -92,6 +92,8 @@ func loadGerritOriginInternal(origin, remoteOrigin string) error { if !strings.HasPrefix(origin, "https://") { return fmt.Errorf("git origin must be an https:// URL: %s", origin) } + // Remove trailing slash from the origin, if any. + origin = strings.TrimRight(origin, "/") // https:// prefix and then one slash between host and top-level name if strings.Count(origin, "/") != 3 { return fmt.Errorf("git origin is malformed: %s", origin) |
