diff options
Diffstat (limited to 'go/internal/handler/receive_pack.go')
-rw-r--r-- | go/internal/handler/receive_pack.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/go/internal/handler/receive_pack.go b/go/internal/handler/receive_pack.go index 5e38aca..781bbab 100644 --- a/go/internal/handler/receive_pack.go +++ b/go/internal/handler/receive_pack.go @@ -1,16 +1,26 @@ package handler import ( + "context" "fmt" + "os" pb "gitlab.com/gitlab-org/gitaly-proto/go" + "gitlab.com/gitlab-org/gitaly/client" ) -func ReceivePack(gitalyAddress string, request *pb.SSHReceivePackRequest) error { - repoPath := request.Repository.Path - if repoPath == "" { - return fmt.Errorf("empty path in repository message") +func ReceivePack(gitalyAddress string, request *pb.SSHReceivePackRequest) (int32, error) { + if gitalyAddress == "" { + return -1, fmt.Errorf("no gitaly_address given") } - return execCommand("git-receive-pack", repoPath) + conn, err := client.Dial(gitalyAddress, client.DefaultDialOpts) + if err != nil { + return -1, err + } + defer conn.Close() + + ctx, cancel := context.WithCancel(context.TODO()) + defer cancel() + return client.ReceivePack(ctx, conn, os.Stdin, os.Stdout, os.Stderr, request) } |