aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_test.go
diff options
context:
space:
mode:
authorkuba-- <kuba@sourced.tech>2018-08-24 23:44:44 +0200
committerkuba-- <kuba@sourced.tech>2018-08-29 14:38:33 +0200
commit0167dabb78412ed5fb76cb4b174a6708c3be52b8 (patch)
treee35d24139b303a0847996ed1137e0d4c2f2b3a0a /worktree_test.go
parent005d5dc961a7053d88da53536f4a5eb4c305529b (diff)
downloadgo-git-0167dabb78412ed5fb76cb4b174a6708c3be52b8.tar.gz
Remove empty dirs when cleaning with Dir opt.
Signed-off-by: kuba-- <kuba@sourced.tech>
Diffstat (limited to 'worktree_test.go')
-rw-r--r--worktree_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/worktree_test.go b/worktree_test.go
index df191b0..c714011 100644
--- a/worktree_test.go
+++ b/worktree_test.go
@@ -1591,6 +1591,10 @@ func (s *WorktreeSuite) TestClean(c *C) {
c.Assert(len(status), Equals, 1)
+ fi, err := fs.Lstat("pkgA")
+ c.Assert(err, IsNil)
+ c.Assert(fi.IsDir(), Equals, true)
+
// Clean with Dir: true.
err = wt.Clean(&CleanOptions{Dir: true})
c.Assert(err, IsNil)
@@ -1599,6 +1603,11 @@ func (s *WorktreeSuite) TestClean(c *C) {
c.Assert(err, IsNil)
c.Assert(len(status), Equals, 0)
+
+ // An empty dir should be deleted, as well.
+ _, err = fs.Lstat("pkgA")
+ c.Assert(err, ErrorMatches, ".*(no such file or directory.*|.*file does not exist)*.")
+
}
func (s *WorktreeSuite) TestAlternatesRepo(c *C) {