From d5547156c3260e807453634bb5ea3edbbea0fef8 Mon Sep 17 00:00:00 2001 From: Ash McKenzie Date: Tue, 24 Dec 2019 15:36:07 +1100 Subject: Remove support for Custom data.info_message --- internal/command/receivepack/customaction.go | 4 ---- internal/command/receivepack/customaction_test.go | 2 -- internal/gitlabnet/accessverifier/client.go | 1 - internal/gitlabnet/accessverifier/client_test.go | 1 - .../testdata/testroot/responses/allowed_with_payload.json | 3 +-- spec/gitlab_shell_custom_git_receive_pack_spec.rb | 8 +------- 6 files changed, 2 insertions(+), 17 deletions(-) diff --git a/internal/command/receivepack/customaction.go b/internal/command/receivepack/customaction.go index 7575ee9..6693d23 100644 --- a/internal/command/receivepack/customaction.go +++ b/internal/command/receivepack/customaction.go @@ -7,9 +7,7 @@ import ( "io" "io/ioutil" "net/http" - "strings" - "gitlab.com/gitlab-org/gitlab-shell/internal/console" "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet" "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier" ) @@ -33,8 +31,6 @@ func (c *Command) processCustomAction(response *accessverifier.Response) error { return errors.New("Custom action error: Empty API endpoints") } - console.DisplayInfoMessages(strings.Split(data.InfoMessage, "\n"), c.ReadWriter.ErrOut) - return c.processApiEndpoints(response) } diff --git a/internal/command/receivepack/customaction_test.go b/internal/command/receivepack/customaction_test.go index 11e7dce..c55a8f3 100644 --- a/internal/command/receivepack/customaction_test.go +++ b/internal/command/receivepack/customaction_test.go @@ -41,7 +41,6 @@ func TestCustomReceivePack(t *testing.T) { "api_endpoints": []string{"/geo/proxy_git_push_ssh/info_refs", "/geo/proxy_git_push_ssh/push"}, "gl_username": "custom", "primary_repo": "https://repo/path", - "info_message": "info_message\none more message", }, }, } @@ -100,6 +99,5 @@ func TestCustomReceivePack(t *testing.T) { // expect printing of info message, "custom" string from the first request // and "output" string from the second request - require.Equal(t, "remote: \nremote: info_message\nremote: one more message\nremote: \n", errBuf.String()) require.Equal(t, "customoutput", outBuf.String()) } diff --git a/internal/gitlabnet/accessverifier/client.go b/internal/gitlabnet/accessverifier/client.go index 3075ede..302a9e1 100644 --- a/internal/gitlabnet/accessverifier/client.go +++ b/internal/gitlabnet/accessverifier/client.go @@ -41,7 +41,6 @@ type CustomPayloadData struct { ApiEndpoints []string `json:"api_endpoints"` Username string `json:"gl_username"` PrimaryRepo string `json:"primary_repo"` - InfoMessage string `json:"info_message"` UserId string `json:"gl_id,omitempty"` } diff --git a/internal/gitlabnet/accessverifier/client_test.go b/internal/gitlabnet/accessverifier/client_test.go index 96c80a7..0b6c7b0 100644 --- a/internal/gitlabnet/accessverifier/client_test.go +++ b/internal/gitlabnet/accessverifier/client_test.go @@ -97,7 +97,6 @@ func TestGetCustomAction(t *testing.T) { ApiEndpoints: []string{"geo/proxy_git_push_ssh/info_refs", "geo/proxy_git_push_ssh/push"}, Username: "custom", PrimaryRepo: "https://repo/path", - InfoMessage: "message", }, } response.StatusCode = 300 diff --git a/internal/testhelper/testdata/testroot/responses/allowed_with_payload.json b/internal/testhelper/testdata/testroot/responses/allowed_with_payload.json index 331c3a9..4996b2a 100644 --- a/internal/testhelper/testdata/testroot/responses/allowed_with_payload.json +++ b/internal/testhelper/testdata/testroot/responses/allowed_with_payload.json @@ -22,8 +22,7 @@ "data": { "api_endpoints": ["geo/proxy_git_push_ssh/info_refs", "geo/proxy_git_push_ssh/push"], "gl_username": "custom", - "primary_repo": "https://repo/path", - "info_message": "message" + "primary_repo": "https://repo/path" } }, "git_protocol": "protocol", diff --git a/spec/gitlab_shell_custom_git_receive_pack_spec.rb b/spec/gitlab_shell_custom_git_receive_pack_spec.rb index 4b0fec4..771ef1e 100644 --- a/spec/gitlab_shell_custom_git_receive_pack_spec.rb +++ b/spec/gitlab_shell_custom_git_receive_pack_spec.rb @@ -52,8 +52,7 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do "data" => { "api_endpoints" => ["/geo/proxy_git_push_ssh/info_refs", "/geo/proxy_git_push_ssh/push"], "gl_username" => "custom", - "primary_repo" => "https://repo/path", - "info_message" => "info_message\nanother_message", + "primary_repo" => "https://repo/path" }, }, "gl_console_messages" => ["console", "message"] @@ -75,11 +74,6 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do expect(stderr.gets).to eq("remote: message\n") expect(stderr.gets).to eq(remote_blank_line) - expect(stderr.gets).to eq(remote_blank_line) - expect(stderr.gets).to eq("remote: info_message\n") - expect(stderr.gets).to eq("remote: another_message\n") - expect(stderr.gets).to eq(remote_blank_line) - stdin.puts("input") stdin.close -- cgit v1.2.1