Skip to content

Commit

Permalink
chore: dumping git command in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hferentschik committed Jan 16, 2020
1 parent 6938052 commit 9345f7f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/gits/git_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ type GitCLI struct {

// NewGitCLI creates a new GitCLI instance
func NewGitCLI() *GitCLI {
return &GitCLI{
cli := &GitCLI{
Env: map[string]string{},
}
// Ensure that error output is in English so parsing work
cli.Env["LC_ALL"] = "C"
return cli
}

// FindGitConfigDir tries to find the `.git` directory either in the current directory or in parent directories
Expand Down Expand Up @@ -550,8 +553,7 @@ func (g *GitCLI) gitCmd(dir string, args ...string) error {
Args: args,
Env: g.Env,
}
// Ensure that error output is in English so parsing work
cmd.Env = map[string]string{"LC_ALL": "C"}
log.Logger().Debug(cmd.String())
output, err := cmd.RunWithoutRetry()
return errors.Wrapf(err, "git output: %s", output)
}
Expand All @@ -561,9 +563,9 @@ func (g *GitCLI) gitCmdWithOutput(dir string, args ...string) (string, error) {
Dir: dir,
Name: "git",
Args: args,
Env: g.Env,
}
// Ensure that error output is in English so parsing work
cmd.Env = map[string]string{"LC_ALL": "C"}
log.Logger().Debug(cmd.String())
return cmd.RunWithoutRetry()
}

Expand Down

0 comments on commit 9345f7f

Please sign in to comment.