commit 1
This commit is contained in:
36
git/git.go
Normal file
36
git/git.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user