diff options
author | Paul Okstad <pokstad@gitlab.com> | 2020-11-05 20:54:20 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2020-11-10 10:46:54 +0300 |
commit | db0b171b4a310bfb12cfb54c0470296ed77c0cd8 (patch) | |
tree | f54f8298f97066f6fdd9267a5f163c56a02c4cf1 | |
parent | 979310dc58d6bfeb93a7ec40b6ab2e9bcd17efcd (diff) |
Add ref hook option to SmartHTTP receive-pack
-rw-r--r-- | internal/gitaly/service/repository/testdata/gitlab-shell/config.yml | 2 | ||||
-rw-r--r-- | internal/gitaly/service/smarthttp/inforefs.go | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml b/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml index 2f6376588..d7abadea0 100644 --- a/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml +++ b/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml @@ -1,4 +1,4 @@ -gitlab_url: http://127.0.0.1:51256 +gitlab_url: http://127.0.0.1:53058 http_settings: user: "" password: "" diff --git a/internal/gitaly/service/smarthttp/inforefs.go b/internal/gitaly/service/smarthttp/inforefs.go index dd4b78a24..71034daaa 100644 --- a/internal/gitaly/service/smarthttp/inforefs.go +++ b/internal/gitaly/service/smarthttp/inforefs.go @@ -9,6 +9,7 @@ import ( log "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/internal/git" "gitlab.com/gitlab-org/gitaly/internal/git/pktline" + "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/gitaly/streamio" "google.golang.org/grpc/codes" @@ -48,8 +49,10 @@ func (s *server) handleInfoRefs(ctx context.Context, service string, req *gitaly } var globalOpts []git.Option + cmdOpts := []git.CmdOpt{git.WithGitProtocol(ctx, req)} if service == "receive-pack" { globalOpts = append(globalOpts, git.ReceivePackConfig()...) + cmdOpts = append(cmdOpts, git.WithRefTxHook(ctx, req.Repository, config.Config)) } if service == "upload-pack" { @@ -64,7 +67,7 @@ func (s *server) handleInfoRefs(ctx context.Context, service string, req *gitaly Name: service, Flags: []git.Option{git.Flag{Name: "--stateless-rpc"}, git.Flag{Name: "--advertise-refs"}}, Args: []string{repoPath}, - }, git.WithGitProtocol(ctx, req)) + }, cmdOpts...) if err != nil { if _, ok := status.FromError(err); ok { |