Skip to content

Commit

Permalink
check git configuration before exec world create
Browse files Browse the repository at this point in the history
  • Loading branch information
zulkhair committed Sep 4, 2024
1 parent c5b6dbe commit 096d3c4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions common/teacmd/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ type GitCloneFinishMsg struct {

func git(args ...string) (string, error) {
var outBuff, errBuff bytes.Buffer
_, err := sh.Exec(nil, &outBuff, &errBuff, "git", args...)

// Define environment variables
env := map[string]string{
"GIT_COMMITTER_NAME": "World CLI",
"GIT_COMMITTER_EMAIL": "no-reply@world.dev",
}

_, err := sh.Exec(env, &outBuff, &errBuff, "git", args...)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -94,7 +101,7 @@ func GitCloneCmd(url string, targetDir string, initMsg string) error {
return err
}

_, err = git("commit", "-m", initMsg)
_, err = git("commit", "--author=\"World CLI <no-reply@world.dev>\"", "-m", initMsg)
if err != nil {
return err
}
Expand Down

0 comments on commit 096d3c4

Please # to comment.