Support fastforwarding worktree

This commit is contained in:
Jesse Duffield 2023-07-24 17:16:59 +10:00
parent a313b16704
commit b3060065d9
6 changed files with 107 additions and 4 deletions

View file

@ -1,6 +1,8 @@
package git_commands
import "strings"
import (
"strings"
)
// convenience struct for building git commands. Especially useful when
// including conditional args
@ -66,6 +68,14 @@ func (self *GitCommandBuilder) GitDir(path string) *GitCommandBuilder {
return self
}
func (self *GitCommandBuilder) GitDirIf(condition bool, path string) *GitCommandBuilder {
if condition {
return self.GitDir(path)
}
return self
}
func (self *GitCommandBuilder) ToArgv() []string {
return append([]string{"git"}, self.args...)
}