Fix deleteRepos in mirror-github
When support for github enterprise was added (5208c28),
deleting stale repos for github.com broke.
`baseURL` is set to something like `https://github.com/foouser/barrepo`.
Doing `url.Parse(baseURL + user)` would then result in
`https://github.com/foouser/barrepofoouser`, which clearly does not
work.
To fix this, we now parse the baseURL and then modify the path to be the
user, resulting in the correct URL: `https://github.com/foouser`.
Change-Id: I1df0bfa214689e2ecc009878961ce27f6f178509
diff --git a/cmd/zoekt-mirror-github/main.go b/cmd/zoekt-mirror-github/main.go
index 7973362..1131a28 100644
--- a/cmd/zoekt-mirror-github/main.go
+++ b/cmd/zoekt-mirror-github/main.go
@@ -161,10 +161,11 @@
} else {
return nil
}
- u, err := url.Parse(baseURL + user)
+ u, err := url.Parse(baseURL)
if err != nil {
return err
}
+ u.Path = user
paths, err := gitindex.ListRepos(destDir, u)
if err != nil {