0
0
mirror of https://github.com/thegeeklab/wp-git-action.git synced 2024-09-20 01:12:47 +02:00
wp-git-action/git/config.go

68 lines
1.1 KiB
Go

package git
import (
"os"
"os/exec"
"strconv"
)
// repoUserEmail sets the global git author email.
func ConfigAutocorrect(repo Repository) *exec.Cmd {
cmd := exec.Command(
"git",
"config",
"--local",
"help.autocorrect",
repo.Autocorrect,
)
cmd.Dir = repo.WorkDir
cmd.Stderr = os.Stderr
return cmd
}
// repoUserEmail sets the global git author email.
func ConfigUserEmail(repo Repository) *exec.Cmd {
cmd := exec.Command(
"git",
"config",
"--local",
"user.email",
repo.Author.Email,
)
cmd.Dir = repo.WorkDir
cmd.Stderr = os.Stderr
return cmd
}
// repoUserName sets the global git author name.
func ConfigUserName(repo Repository) *exec.Cmd {
cmd := exec.Command(
"git",
"config",
"--local",
"user.name",
repo.Author.Name,
)
cmd.Dir = repo.WorkDir
cmd.Stderr = os.Stderr
return cmd
}
// repoSSLVerify disables globally the git ssl verification.
func ConfigSSLVerify(repo Repository) *exec.Cmd {
cmd := exec.Command(
"git",
"config",
"--local",
"http.sslVerify",
strconv.FormatBool(repo.SSLVerify),
)
cmd.Dir = repo.WorkDir
cmd.Stderr = os.Stderr
return cmd
}