Skip to content

Commit 799417a

Browse files
committed
- Update gitaly vendoring
- Wire up gitaly-*-pack to Gitaly. Don't pass git-*-pack to go - Disable tests for go1.5 & 1.6
1 parent 4539a06 commit 799417a

File tree

25 files changed

+3197
-170
lines changed

25 files changed

+3197
-170
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ go:1.7:
6363
<<: *go_definition
6464
image: golang:1.7
6565

66-
go:1.6:
67-
<<: *go_definition
68-
image: golang:1.6
69-
70-
go:1.5:
71-
<<: *go_definition
72-
image: golang:1.5
73-
7466
codeclimate:
7567
before_script: []
7668
image: docker:latest

go/cmd/gitaly-receive-pack/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ func main() {
2929
logger.Fatal("unmarshaling request json failed", err)
3030
}
3131

32-
if err := handler.ReceivePack(os.Args[1], &request); err != nil {
32+
code, err := handler.ReceivePack(os.Args[1], &request)
33+
if err != nil {
3334
logger.Fatal("receive-pack failed", err)
3435
}
36+
os.Exit(int(code))
3537
}

go/cmd/gitaly-upload-pack/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ func main() {
2929
logger.Fatal("unmarshaling request json failed", err)
3030
}
3131

32-
if err := handler.UploadPack(os.Args[1], &request); err != nil {
32+
code, err := handler.UploadPack(os.Args[1], &request)
33+
if err != nil {
3334
logger.Fatal("upload-pack failed", err)
3435
}
36+
os.Exit(int(code))
3537
}
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
package handler
22

33
import (
4+
"context"
45
"fmt"
6+
"os"
57

68
pb "gitlab.com/gitlab-org/gitaly-proto/go"
9+
"gitlab.com/gitlab-org/gitaly/client"
710
)
811

9-
func ReceivePack(gitalyAddress string, request *pb.SSHReceivePackRequest) error {
10-
repoPath := request.Repository.Path
11-
if repoPath == "" {
12-
return fmt.Errorf("empty path in repository message")
12+
func ReceivePack(gitalyAddress string, request *pb.SSHReceivePackRequest) (int32, error) {
13+
if gitalyAddress == "" {
14+
return -1, fmt.Errorf("no gitaly_address given")
1315
}
1416

15-
return execCommand("git-receive-pack", repoPath)
17+
conn, err := client.Dial(gitalyAddress, client.DefaultDialOpts)
18+
if err != nil {
19+
return -1, err
20+
}
21+
defer conn.Close()
22+
23+
ctx, cancel := context.WithCancel(context.TODO())
24+
defer cancel()
25+
return client.ReceivePack(ctx, conn, os.Stdin, os.Stdout, os.Stderr, request)
1626
}

go/internal/handler/upload_pack.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
package handler
22

33
import (
4+
"context"
45
"fmt"
6+
"os"
57

68
pb "gitlab.com/gitlab-org/gitaly-proto/go"
9+
"gitlab.com/gitlab-org/gitaly/client"
710
)
811

9-
func UploadPack(gitalyAddress string, request *pb.SSHUploadPackRequest) error {
10-
repoPath := request.Repository.Path
11-
if repoPath == "" {
12-
return fmt.Errorf("empty path in repository message")
12+
func UploadPack(gitalyAddress string, request *pb.SSHUploadPackRequest) (int32, error) {
13+
if gitalyAddress == "" {
14+
return -1, fmt.Errorf("no gitaly_address given")
1315
}
1416

15-
return execCommand("git-upload-pack", repoPath)
17+
conn, err := client.Dial(gitalyAddress, client.DefaultDialOpts)
18+
if err != nil {
19+
return -1, err
20+
}
21+
defer conn.Close()
22+
23+
ctx, cancel := context.WithCancel(context.TODO())
24+
defer cancel()
25+
return client.UploadPack(ctx, conn, os.Stdin, os.Stdout, os.Stderr, request)
1626
}

go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/VERSION

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)