Skip to content

Commit f0e3411

Browse files
committed
chore: set environment variables for git execution
- Ensured consistent environment for git commands by explicitly setting PATH, HOME, LC_ALL, and LANG - Prevented locale-related issues and improved reproducibility of git operations
1 parent c4e24c5 commit f0e3411

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/git/git.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package git
33
import (
44
"bytes"
55
"fmt"
6+
"os"
67
"os/exec"
78
"strings"
89
)
@@ -24,6 +25,12 @@ func RunGit(dir string, args ...string) (string, error) {
2425
args = append([]string{"-c", "commit.gpgsign=false"}, args...)
2526

2627
c := exec.Command(gitPath, args...)
28+
c.Env = []string{
29+
"PATH=" + os.Getenv("PATH"),
30+
"HOME=" + os.Getenv("HOME"),
31+
"LC_ALL=C",
32+
"LANG=C",
33+
}
2734
var output bytes.Buffer
2835
c.Stderr = &output
2936
c.Stdout = &output

0 commit comments

Comments
 (0)