-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add git daemon server and cli command #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7f3b300 to
0508730
Compare
This adds a new `gogit daemon` command that starts a Git TCP server. It uses a local pure Go implementation for handling Git protocol server requests using the standard library net package under server/git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a pure Go Git daemon server implementation under server/git and a new gogit daemon CLI command.
- Adds
Servertype with lifecycle methods (ListenAndServe,Shutdown, etc.) for Git TCP protocol handling. - Introduces
LoggingMiddlewareto wrap protocol handlers with request logging. - Extends the CLI with a
daemonsubcommand to launch the Git daemon and improves root command error handling.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/git/server.go | Core TCP server implementation for Git protocol. |
| server/git/logging.go | Middleware to log incoming Git requests. |
| cmd/gogit/main.go | Enhanced root command error reporting for remote errors. |
| cmd/gogit/daemon.go | New daemon command to start the Git daemon. |
Comments suppressed due to low confidence (2)
server/git/server.go:54
- The doc for Handler refers to
[DefaultHandler]but the actual fallback isDefaultBackend. Update the reference to[DefaultBackend]to match implementation.
// [DefaultHandler] when nil.
server/git/server.go:85
- [nitpick] There are no tests validating shutdown behavior (idle connection polling, listener closure, context cancellation). Consider adding unit tests for
Shutdownto ensure graceful teardown works as expected.
func (s *Server) Shutdown(ctx context.Context) error {
| ) | ||
|
|
||
| func init() { | ||
| daemonCmd.Flags().BoolVarP(&daemonExportAll, "export-all", "", false, "Export all repositories") |
Copilot
AI
Jul 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The --export-all flag is registered but never used. Consider wiring it into the gitbackend.NewBackend loader logic or removing the flag.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pjbgf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aymanbagabas thanks for working on this. Overall LGTM, apart from the stat/lstat below.
Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com>
This adds a new
gogit daemoncommand that starts a Git TCP server. It uses a local pure Go implementation for handling Git protocol server requests using the standard library net package under server/git.