diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-08-29 16:52:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-29 16:52:20 +0200 |
commit | 34b101e3e2e4c7de728f9d149ef9bf1ae298a9b3 (patch) | |
tree | 79b51316a608a848f60360fd76f1ca671c471579 /worktree_test.go | |
parent | 5cc316baa64287c7e56cb7372a5046c30fd955c1 (diff) | |
parent | 75fa41d21c8d27ee0d5d7c7cb7ceeb2b765be330 (diff) | |
download | go-git-34b101e3e2e4c7de728f9d149ef9bf1ae298a9b3.tar.gz |
Merge pull request #933 from kuba--/fix-895/clean-dir
Remove empty dirs when cleaning with Dir opt.
Diffstat (limited to 'worktree_test.go')
-rw-r--r-- | worktree_test.go | 9 |
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) { |