From 0f440d47e8892ed4ab577ed246ba5ecb08b2c4a1 Mon Sep 17 00:00:00 2001 From: Jeeva Kandasamy Date: Tue, 28 May 2024 04:16:47 +0530 Subject: [PATCH] log gitRaw execution error output Signed-off-by: Jeeva Kandasamy --- api/pkg/git/git.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api/pkg/git/git.go b/api/pkg/git/git.go index 5f9c2e2d12..030230080c 100644 --- a/api/pkg/git/git.go +++ b/api/pkg/git/git.go @@ -146,8 +146,12 @@ func git(log *zap.SugaredLogger, kind string, args ...string) (string, error) { output, err := rawGit(kind, args...) if err != nil { - log.Errorf("git %s : error %s ;output: %s", strings.Join(args, " "), err.Error(), output) - return "", err + log.Errorw( + "executedCommand", fmt.Sprintf("git %s", strings.Join(args, " ")), + "executedCommandOutput", output, + err, + ) + return output, err } return output, nil } @@ -162,8 +166,6 @@ func rawGit(dir string, args ...string) (string, error) { if dir != "" { c.Dir = dir } - if err := c.Run(); err != nil { - return "", err - } - return output.String(), nil + err := c.Run() + return output.String(), err }