Add worktree tests for removing/detaching

This commit is contained in:
Jesse Duffield 2023-07-24 15:29:23 +10:00
parent 277142fc4b
commit b93b9dae88
9 changed files with 183 additions and 8 deletions

View file

@ -54,9 +54,9 @@ func (self *WorktreeCommands) Delete(worktreePath string, force bool) error {
}
func (self *WorktreeCommands) Detach(worktreePath string) error {
cmdArgs := NewGitCmd("checkout").Arg("--detach").ToArgv()
cmdArgs := NewGitCmd("checkout").Arg("--detach").GitDir(filepath.Join(worktreePath, ".git")).ToArgv()
return self.cmd.New(cmdArgs).SetWd(worktreePath).Run()
return self.cmd.New(cmdArgs).Run()
}
func (self *WorktreeCommands) IsCurrentWorktree(path string) bool {