aboutsummaryrefslogtreecommitdiffstats
path: root/worktree.go
diff options
context:
space:
mode:
authorhansmi <hansmi@users.noreply.github.com>2021-01-27 10:49:40 +0100
committerGitHub <noreply@github.com>2021-01-27 10:49:40 +0100
commit024d62b96ac19b40473f04931f9c12c8e24e0f7a (patch)
treeb49e2ad17080f3a1236f0fb502a2895c11ae0073 /worktree.go
parent1b1a61ad07f40197d3b9164821a096abd1710628 (diff)
downloadgo-git-024d62b96ac19b40473f04931f9c12c8e24e0f7a.tar.gz
worktree: Don't remove root directory when cleaning (#230)
When using a separate worktree directory while working on a bare repository, cleaning with CleanOptions{Dir: true} would also remove the root worktree directory if empty. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Diffstat (limited to 'worktree.go')
-rw-r--r--worktree.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/worktree.go b/worktree.go
index 73e638a..4aeae01 100644
--- a/worktree.go
+++ b/worktree.go
@@ -771,7 +771,7 @@ func (w *Worktree) doClean(status Status, opts *CleanOptions, dir string, files
}
}
- if opts.Dir {
+ if opts.Dir && dir != "" {
return doCleanDirectories(w.Filesystem, dir)
}
return nil