aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-16 23:55:24 -0700
committerGitHub <noreply@github.com>2017-07-16 23:55:24 -0700
commit046b15e533b9f3237bf34fbd8da285df921fbca4 (patch)
tree3a82505ca8f144b10a55dde9923f6fced89ae03b /worktree_test.go
parent3ba215f3da8f10834313b5a4de58ca01400e248f (diff)
parentaa74b3ab06c260c2160dcb6110edad888ae1cc25 (diff)
downloadgo-git-046b15e533b9f3237bf34fbd8da285df921fbca4.tar.gz
Merge pull request #480 from mcuadros/empty-status
remote: fix Worktree.Status on empty repository
Diffstat (limited to 'worktree_test.go')
-rw-r--r--worktree_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/worktree_test.go b/worktree_test.go
index 864e19e..4c9907b 100644
--- a/worktree_test.go
+++ b/worktree_test.go
@@ -344,6 +344,25 @@ func (s *WorktreeSuite) TestStatusEmpty(c *C) {
c.Assert(status, NotNil)
}
+func (s *WorktreeSuite) TestStatusEmptyDirty(c *C) {
+ fs := memfs.New()
+ err := util.WriteFile(fs, "foo", []byte("foo"), 0755)
+ c.Assert(err, IsNil)
+
+ storage := memory.NewStorage()
+
+ r, err := Init(storage, fs)
+ c.Assert(err, IsNil)
+
+ w, err := r.Worktree()
+ c.Assert(err, IsNil)
+
+ status, err := w.Status()
+ c.Assert(err, IsNil)
+ c.Assert(status.IsClean(), Equals, false)
+ c.Assert(status, HasLen, 1)
+}
+
func (s *WorktreeSuite) TestReset(c *C) {
fs := memfs.New()
w := &Worktree{