diff --git a/internal/gitaly/hook/prereceive.go b/internal/gitaly/hook/prereceive.go index 96191c712b69096d2e222558e801add9bb3f8802..d0d05db5f1b28a20c7572d69d4c320e82f135ef1 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 274a5e3f7a85678c7135855624a6e302888350c0..a667af16c290dd2d6dd7b53ea7e67120b90eba08 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 e52787b7332914c05d72364e967766a1da215f0a..c4c26b799df57c76087e49204c7b99647fa4c02d 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 {