···3333 allowPush bool
3434}
35353636-// plainStorer hides the underlying storer's PackfileWriter implementation.
3737-//
3838-// transport.ReceivePack stores an incoming pack via packfile.UpdateObjectStorage,
3939-// which has two paths: a storer.PackfileWriter fast-path that copies the client
4040-// stream to EOF, and a parser fallback that reads exactly one self-delimiting
4141-// pack. A git:// client keeps the socket open after its pack, waiting for
4242-// report-status, so it never sends EOF and the fast-path copy deadlocks. By not
4343-// advertising PackfileWriter we take the parser path, which stops at the pack
4444-// trailer. Objects land as loose objects rather than a packfile.
4545-type plainStorer struct {
4646- storage.Storer
4747-}
4848-4936// Serve accepts connections on l until ctx is cancelled or Accept fails.
5037func (d *daemon) Serve(ctx context.Context, l net.Listener) error {
5138 go func() {
···114101 GitProtocol: gitProtocol,
115102 })
116103104104+ case transport.UploadArchiveService:
105105+ st, err := d.loader.Load(&url.URL{Path: req.Pathname})
106106+ if err != nil {
107107+ _, _ = pktline.WriteError(conn, fmt.Errorf("repository %q not found", req.Pathname))
108108+ return fmt.Errorf("loading %q: %w", req.Pathname, err)
109109+ }
110110+ return transport.UploadArchive(ctx, st, r, conn, &transport.UploadArchiveRequest{})
111111+117112 case transport.ReceivePackService:
118113 if !d.allowPush {
119114 _, _ = pktline.WriteError(conn, fmt.Errorf("push is disabled on this server"))
···124119 _, _ = pktline.WriteError(conn, fmt.Errorf("cannot open repository %q", req.Pathname))
125120 return fmt.Errorf("opening %q for push: %w", req.Pathname, err)
126121 }
127127- return transport.ReceivePack(ctx, plainStorer{st}, r, conn, &transport.ReceivePackRequest{
122122+ return transport.ReceivePack(ctx, st, r, conn, &transport.ReceivePackRequest{
128123 GitProtocol: gitProtocol,
129124 })
130125