Skip to content

Commit 5d52733

Browse files
authored
Merge pull request #3 from devtron-labs/git-log
fix: git network operation missing logs
2 parents 709cc28 + d82a3d9 commit 5d52733

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/git/GitCliUtil.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ func (impl *GitUtil) Fetch(rootDir string, username string, password string) (re
2727
cmd := exec.Command("git", "-C", rootDir, "fetch", "origin", "--tags", "--force")
2828
output, errMsg, err := impl.runCommandWithCred(cmd, username, password)
2929
impl.logger.Debugw("fetch output", "root", rootDir, "opt", output, "errMsg", errMsg, "error", err)
30-
return output, errMsg, nil
30+
return output, errMsg, err
3131
}
3232

3333
func (impl *GitUtil) Checkout(rootDir string, branch string) (response, errMsg string, err error) {
3434
impl.logger.Debugw("git checkout ", "location", rootDir)
3535
cmd := exec.Command("git", "-C", rootDir, "checkout", branch, "--force")
3636
output, errMsg, err := impl.runCommand(cmd)
3737
impl.logger.Debugw("checkout output", "root", rootDir, "opt", output, "errMsg", errMsg, "error", err)
38-
return output, errMsg, nil
38+
return output, errMsg, err
3939
}
4040

4141
func (impl *GitUtil) runCommandWithCred(cmd *exec.Cmd, userName, password string) (response, errMsg string, err error) {
@@ -51,9 +51,10 @@ func (impl *GitUtil) runCommand(cmd *exec.Cmd) (response, errMsg string, err err
5151
cmd.Env = append(cmd.Env, "HOME=/dev/null")
5252
outBytes, err := cmd.CombinedOutput()
5353
if err != nil {
54+
impl.logger.Error("error in git cli operation", "msg", string(outBytes), "err", err)
5455
exErr, ok := err.(*exec.ExitError)
5556
if !ok {
56-
return "", "", err
57+
return "", string(outBytes), err
5758
}
5859
errOutput := string(exErr.Stderr)
5960
return "", errOutput, err

0 commit comments

Comments
 (0)