gsquash/git/git.go
2023-12-05 19:03:27 +00:00

37 lines
759 B
Go

package git
type Git struct {
// Executable is the path to the git executable
Executable string
// WorkingDir is the path to the working directory
WorkingDir string
// MainBranch is the name of the main branch
MainBranch string
}
// NewGitInput is the input type for NewGit
type NewGitInput struct {
// Executable is the path to the git executable
Executable string
// WorkingDir is the path to the working directory
WorkingDir *string
// MainBranch is the name of the main branch
MainBranch string
}
// NewGit creates a new Git
func NewGit(input *NewGitInput) *Git {
git := &Git{
Executable: input.Executable,
}
if git.Executable == "" {
git.Executable = "git"
}
if git.MainBranch == "" {
git.MainBranch = "main"
}
return git
}