Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'client/receive_pack.go')
-rw-r--r--client/receive_pack.go31
1 files changed, 2 insertions, 29 deletions
diff --git a/client/receive_pack.go b/client/receive_pack.go
index c59f87d06..2d8d68e44 100644
--- a/client/receive_pack.go
+++ b/client/receive_pack.go
@@ -4,39 +4,12 @@ import (
"context"
"io"
- "gitlab.com/gitlab-org/gitaly/v16/internal/stream"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/gitalyclient"
"gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"
- "gitlab.com/gitlab-org/gitaly/v16/streamio"
"google.golang.org/grpc"
)
// ReceivePack proxies an SSH git-receive-pack (git push) session to Gitaly
func ReceivePack(ctx context.Context, conn *grpc.ClientConn, stdin io.Reader, stdout, stderr io.Writer, req *gitalypb.SSHReceivePackRequest) (int32, error) {
- ctx2, cancel := context.WithCancel(ctx)
- defer cancel()
-
- ssh := gitalypb.NewSSHServiceClient(conn)
- receivePackStream, err := ssh.SSHReceivePack(ctx2)
- if err != nil {
- return 0, err
- }
-
- if err = receivePackStream.Send(req); err != nil {
- return 0, err
- }
-
- inWriter := streamio.NewWriter(func(p []byte) error {
- return receivePackStream.Send(&gitalypb.SSHReceivePackRequest{Stdin: p})
- })
-
- return stream.Handler(func() (stream.StdoutStderrResponse, error) {
- return receivePackStream.Recv()
- }, func(errC chan error) {
- _, errRecv := io.Copy(inWriter, stdin)
- if err := receivePackStream.CloseSend(); err != nil && errRecv == nil {
- errC <- err
- } else {
- errC <- errRecv
- }
- }, stdout, stderr)
+ return gitalyclient.ReceivePack(ctx, conn, stdin, stdout, stderr, req)
}