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:
authorPaul Okstad <pokstad@gitlab.com>2020-11-05 20:21:25 +0300
committerPaul Okstad <pokstad@gitlab.com>2020-11-10 10:46:54 +0300
commit979310dc58d6bfeb93a7ec40b6ab2e9bcd17efcd (patch)
tree0a330c16a1dccb360483b5da7a3b5efa66f57ef4
parent97119621a83292e10060785c43bd00ceffdef53b (diff)
Add ref hooks to SSH receive-pack
-rw-r--r--internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret1
-rw-r--r--internal/gitaly/service/repository/testdata/gitlab-shell/config.yml5
-rw-r--r--internal/gitaly/service/ssh/receive_pack.go14
3 files changed, 16 insertions, 4 deletions
diff --git a/internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret b/internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret
new file mode 100644
index 000000000..4ba7b338f
--- /dev/null
+++ b/internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret
@@ -0,0 +1 @@
+topsecret \ No newline at end of file
diff --git a/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml b/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml
new file mode 100644
index 000000000..2f6376588
--- /dev/null
+++ b/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml
@@ -0,0 +1,5 @@
+gitlab_url: http://127.0.0.1:51256
+http_settings:
+ user: ""
+ password: ""
+custom_hooks_dir: ""
diff --git a/internal/gitaly/service/ssh/receive_pack.go b/internal/gitaly/service/ssh/receive_pack.go
index 4d62adaf0..d949eeb87 100644
--- a/internal/gitaly/service/ssh/receive_pack.go
+++ b/internal/gitaly/service/ssh/receive_pack.go
@@ -9,6 +9,7 @@ import (
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitaly/internal/command"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/streamio"
@@ -65,10 +66,15 @@ func (s *server) sshReceivePack(stream gitalypb.SSHService_SSHReceivePackServer,
globalOpts = append(globalOpts, git.ValueFlag{"-c", o})
}
- cmd, err := git.SafeBareCmd(ctx, git.CmdStream{In: stdin, Out: stdout, Err: stderr}, nil, globalOpts, git.SubCmd{
- Name: "receive-pack",
- Args: []string{repoPath},
- }, git.WithReceivePackHooks(ctx, req, "ssh"), git.WithGitProtocol(ctx, req))
+ cmd, err := git.SafeBareCmd(ctx, git.CmdStream{In: stdin, Out: stdout, Err: stderr}, nil, globalOpts,
+ git.SubCmd{
+ Name: "receive-pack",
+ Args: []string{repoPath},
+ },
+ git.WithReceivePackHooks(ctx, req, "ssh"),
+ git.WithGitProtocol(ctx, req),
+ git.WithRefTxHook(ctx, req.Repository, config.Config),
+ )
if err != nil {
return fmt.Errorf("start cmd: %v", err)