Add Gerrit forge adapter#119
Conversation
|
+1 on this feature, fills the single gap that I have for the cli tool, will run a qa on it against my gerrit and provide feedback. |
andrew
left a comment
There was a problem hiding this comment.
Thanks for this, the adapter is well structured and follows the existing gitea/gitlab shape closely. Tests pass locally and pr checkout will work for Gerrit changes for free since #117 already handles refs/-prefixed head refs.
A few things to address before merging, see inline. The main ones are the Code-Review label type, the hardcoded abandon/restore messages, and the gerrit-review.googlesource.com default which doesn't actually work with the auth scheme implemented here.
andrew
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. Labels, abandon/restore/submit bodies, PathUnescape and the intString cleanup all look good.
Two things from the follow-up commit:
Dropping case "gerrit" from defaultDomainForType means it now falls through to github.com — resolve_test.go and repo_test.go even assert {"gerrit", "github.com"}. That's worse than the googlesource default; forge --type gerrit ... without a host will quietly hit github. Return "" for gerrit and have the callers error when the domain is empty.
The HTMLURL change in convertProject went to the wrong spot. /admin/repos/<encoded> was the correct repo page; the comment was about BlobURL building on top of it. I'd revert HTMLURL to /admin/repos/... and have BlobURL just return repoHTMLURL (no good file-browse URL without gitiles).
|
thanks for catching those, I've reverted the HTMLURL logic back to using the /admin/repos/ endpoint and updated BlobURL to just return the repoHTMLURL . I also fixed the domain resolution so that defaultDomainForType explicitly returns an empty string for gerrit , causing the CLI to correctly error out when a domain isn't provided rather than quietly defaulting to github.com. the test assertions have been updated to reflect this behavior too. |
Summary
Adds initial Gerrit support as a forge adapter.
This maps Gerrit projects, branches, tags, files, and changes into the existing forge interfaces where they fit cleanly. Unsupported Gerrit concepts explicitly return
ErrNotSupported.Closes #12.
What works
gerritforge type and detection via/config/server/versionTests
go test ./...git diff --check