summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJoel Baranick <joel.baranick@ensighten.com>2022-09-02 21:38:16 -0700
committerJesse Duffield <jessedduffield@gmail.com>2023-07-30 18:35:21 +1000
commit1ce9a87544c87629567812fbb72d4f4a4f37bdf9 (patch)
tree525483b9b74558f8c6ce8f3c050686ad8ce5345e /pkg/commands
parent35e6e6347a37910a48ad312663d5f8ee6f929496 (diff)
Basic support for adding a worktree
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/worktree.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/worktree.go b/pkg/commands/git_commands/worktree.go
index 84931f0cd..71ffb7aa3 100644
--- a/pkg/commands/git_commands/worktree.go
+++ b/pkg/commands/git_commands/worktree.go
@@ -10,6 +10,12 @@ func NewWorktreeCommands(gitCommon *GitCommon) *WorktreeCommands {
}
}
+func (self *WorktreeCommands) New(worktreePath string) error {
+ cmdArgs := NewGitCmd("worktree").Arg("add", worktreePath).ToArgv()
+
+ return self.cmd.New(cmdArgs).Run()
+}
+
func (self *WorktreeCommands) Delete(worktreePath string, force bool) error {
cmdArgs := NewGitCmd("worktree").Arg("remove").ArgIf(force, "-f").Arg(worktreePath).ToArgv()