Return an error instead of logging it when failing to delete the worktree.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Masayuki Matsuki 2026-04-11 16:59:05 +09:00 committed by GitHub
parent 8a99bf1670
commit 8506f1f526
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,7 +126,7 @@ func doRm(ctx context.Context, cmd *cli.Command) error {
gitCmd := exec.Command("git", "worktree", "remove", "--force", wt)
gitCmd.Dir = p
if out, gitErr := gitCmd.CombinedOutput(); gitErr != nil {
logger.Log("warning", fmt.Sprintf("failed to remove worktree %s: %v\n%s", wt, gitErr, out))
return fmt.Errorf("failed to remove worktree %s: %w\n%s", wt, gitErr, out)
}
}
if err := os.RemoveAll(p); err != nil {