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 'cmd/gitaly-receive-pack/main.go')
-rw-r--r--cmd/gitaly-receive-pack/main.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/cmd/gitaly-receive-pack/main.go b/cmd/gitaly-receive-pack/main.go
new file mode 100644
index 000000000..0eaaea643
--- /dev/null
+++ b/cmd/gitaly-receive-pack/main.go
@@ -0,0 +1,34 @@
+package main
+
+import (
+ "log"
+ "os"
+ "strings"
+
+ "gitlab.com/gitlab-org/gitaly/client"
+)
+
+func main() {
+ if !(len(os.Args) >= 3 && strings.HasPrefix(os.Args[2], "git-receive-pack")) {
+ log.Fatalf("Not a valid command")
+ }
+
+ addr := os.Getenv("GITALY_SOCKET")
+ if len(addr) == 0 {
+ log.Fatalf("GITALY_SOCKET not set")
+ }
+
+ cli, err := client.NewClient(addr)
+ if err != nil {
+ log.Fatalf("Error: %v", err)
+ }
+ defer cli.Close()
+
+ code, err := cli.ReceivePack(os.Stdin, os.Stdout, os.Stderr, os.Getenv("GL_REPOSITORY"), os.Getenv("GL_ID"))
+ if err != nil {
+ log.Printf("Error: %v", err)
+ os.Exit(int(code))
+ }
+
+ os.Exit(int(code))
+}