summaryrefslogtreecommitdiff
path: root/internal/command/receivepack
diff options
context:
space:
mode:
Diffstat (limited to 'internal/command/receivepack')
-rw-r--r--internal/command/receivepack/customaction.go13
-rw-r--r--internal/command/receivepack/customaction_test.go2
2 files changed, 4 insertions, 11 deletions
diff --git a/internal/command/receivepack/customaction.go b/internal/command/receivepack/customaction.go
index c94ae4c..7575ee9 100644
--- a/internal/command/receivepack/customaction.go
+++ b/internal/command/receivepack/customaction.go
@@ -3,12 +3,13 @@ package receivepack
import (
"bytes"
"errors"
- "fmt"
+
"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"
)
@@ -32,19 +33,11 @@ func (c *Command) processCustomAction(response *accessverifier.Response) error {
return errors.New("Custom action error: Empty API endpoints")
}
- c.displayInfoMessage(data.InfoMessage)
+ console.DisplayInfoMessages(strings.Split(data.InfoMessage, "\n"), c.ReadWriter.ErrOut)
return c.processApiEndpoints(response)
}
-func (c *Command) displayInfoMessage(infoMessage string) {
- messages := strings.Split(infoMessage, "\n")
-
- for _, msg := range messages {
- fmt.Fprintf(c.ReadWriter.ErrOut, "> GitLab: %v\n", msg)
- }
-}
-
func (c *Command) processApiEndpoints(response *accessverifier.Response) error {
client, err := gitlabnet.GetClient(c.Config)
diff --git a/internal/command/receivepack/customaction_test.go b/internal/command/receivepack/customaction_test.go
index 2a4a718..11e7dce 100644
--- a/internal/command/receivepack/customaction_test.go
+++ b/internal/command/receivepack/customaction_test.go
@@ -100,6 +100,6 @@ 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, "> GitLab: info_message\n> GitLab: one more message\n", errBuf.String())
+ require.Equal(t, "remote: \nremote: info_message\nremote: one more message\nremote: \n", errBuf.String())
require.Equal(t, "customoutput", outBuf.String())
}