This commit is contained in:
2023-12-05 19:03:27 +00:00
commit 6859e01192
11 changed files with 288 additions and 0 deletions

36
git/git.go Normal file
View File

@@ -0,0 +1,36 @@
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
}