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:
authorJacob Vosmaer <jacob@gitlab.com>2022-01-12 16:13:40 +0300
committerJacob Vosmaer <jacob@gitlab.com>2022-01-17 16:18:19 +0300
commit873e1518c101361ae4e411f566ebe6d9c76908cf (patch)
treef26db8fb7399298dc5072efc6cc3062fbea015ed
parent3d2b6d2676bea4db5dca42f16217e72bfdcdc289 (diff)
client: add UploadPackWithSidechannel
This adds UploadPackWithSidechannel which will be used internally by gitaly-ssh, and externally by gitlab-shell.
-rw-r--r--client/upload_pack.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/client/upload_pack.go b/client/upload_pack.go
index d0f4ea60b..8d971804b 100644
--- a/client/upload_pack.go
+++ b/client/upload_pack.go
@@ -40,3 +40,26 @@ func UploadPack(ctx context.Context, conn *grpc.ClientConn, stdin io.Reader, std
}
}, stdout, stderr)
}
+
+// UploadPackWithSidechannel proxies an SSH git-upload-pack (git fetch)
+// session to Gitaly using a sidechannel for the raw data transfer.
+func UploadPackWithSidechannel(ctx context.Context, conn *grpc.ClientConn, reg *SidechannelRegistry, stdin io.Reader, stdout, stderr io.Writer, req *gitalypb.SSHUploadPackWithSidechannelRequest) (int32, error) {
+ ctx, cancel := context.WithCancel(ctx)
+ defer cancel()
+
+ ctx, wt := reg.Register(ctx, func(c SidechannelConn) error {
+ return stream.ProxyPktLine(c, stdin, stdout, stderr)
+ })
+ defer wt.Close()
+
+ sshClient := gitalypb.NewSSHServiceClient(conn)
+ if _, err := sshClient.SSHUploadPackWithSidechannel(ctx, req); err != nil {
+ return 0, err
+ }
+
+ if err := wt.Close(); err != nil {
+ return 0, err
+ }
+
+ return 0, nil
+}