From 8638dfeb7d719a6ff3c4f28a9d6951443be2728c Mon Sep 17 00:00:00 2001 From: Serena Fang Date: Wed, 24 Apr 2024 12:32:46 -0500 Subject: [PATCH] Add push options to params' --- internal/gitaly/hook/prereceive.go | 1 + internal/gitlab/client.go | 2 ++ internal/gitlab/http_client.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/internal/gitaly/hook/prereceive.go b/internal/gitaly/hook/prereceive.go index 96191c712b..d0d05db5f1 100644 --- a/internal/gitaly/hook/prereceive.go +++ b/internal/gitaly/hook/prereceive.go @@ -136,6 +136,7 @@ func (m *GitLabHookManager) preReceiveHook(ctx context.Context, payload git.Hook GLID: payload.UserDetails.UserID, GLProtocol: payload.UserDetails.Protocol, Changes: string(changes), + PushOptions: []string(pushOptions) } allowed, message, err := m.gitlabClient.Allowed(ctx, params) diff --git a/internal/gitlab/client.go b/internal/gitlab/client.go index 274a5e3f7a..a667af16c2 100644 --- a/internal/gitlab/client.go +++ b/internal/gitlab/client.go @@ -22,6 +22,8 @@ type AllowedParams struct { GLProtocol string // Changes is a set of changes to be applied. Changes string + // PushOptions is + PushOptions []string } // PostReceiveMessage encapsulates a message from the /post_receive endpoint that gets printed to stdout diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go index e52787b733..c4c26b799d 100644 --- a/internal/gitlab/http_client.go +++ b/internal/gitlab/http_client.go @@ -122,6 +122,7 @@ type allowedRequest struct { Username string `json:"username,omitempty"` KeyID string `json:"key_id,omitempty"` UserID string `json:"user_id,omitempty"` + PushOptions []string `json:"push_options,omitempty"` } func (a *allowedRequest) parseAndSetGLID(glID string) error { @@ -170,6 +171,7 @@ func (c *HTTPClient) Allowed(ctx context.Context, params AllowedParams) (bool, s Project: strings.Replace(params.RepoPath, "'", "", -1), RelativePath: params.RelativePath, Env: gitObjDirVars, + PushOptions: params.pushOptions, } if err := req.parseAndSetGLID(params.GLID); err != nil { -- GitLab