diff options
author | Rodrigo Oliveira <rodrigo.redcode@gmail.com> | 2024-02-05 10:55:04 -0300 |
---|---|---|
committer | Rodrigo Oliveira <rodrigo.redcode@gmail.com> | 2024-02-05 10:55:04 -0300 |
commit | 093134604cde84f51625efdcf5266a62cd5ab6e9 (patch) | |
tree | b3f887bf3af5b5dad7489190b39413d8aacee1e8 /worktree_test.go | |
parent | 03a57f8f5179a990083e8b9c2c9e40854ae402ea (diff) | |
download | go-git-093134604cde84f51625efdcf5266a62cd5ab6e9.tar.gz |
git: worktree, Build status based on the current index instead of building it empty. Fixes #119
Diffstat (limited to 'worktree_test.go')
-rw-r--r-- | worktree_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/worktree_test.go b/worktree_test.go index 2c3c592..deaf5e5 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -1052,6 +1052,25 @@ func (s *WorktreeSuite) TestStatusEmptyDirty(c *C) { c.Assert(status, HasLen, 1) } +func (s *WorktreeSuite) TestStatusUnmodified(c *C) { + fs := memfs.New() + w := &Worktree{ + r: s.Repository, + Filesystem: fs, + } + + err := w.Checkout(&CheckoutOptions{Force: true}) + c.Assert(err, IsNil) + + status, err := w.Status() + c.Assert(err, IsNil) + c.Assert(status.IsClean(), Equals, true) + c.Assert(status.IsUntracked("LICENSE"), Equals, false) + + c.Assert(status.File("LICENSE").Staging, Equals, Unmodified) + c.Assert(status.File("LICENSE").Worktree, Equals, Unmodified) +} + func (s *WorktreeSuite) TestReset(c *C) { fs := memfs.New() w := &Worktree{ |