MCPcopy Create free account
hub / github.com/go-git/go-git / TestRemoveDirectory

Method TestRemoveDirectory

worktree_test.go:2128–2150  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

2126}
2127
2128func (s *WorktreeSuite) TestRemoveDirectory(c *C) {
2129 fs := memfs.New()
2130 w := &Worktree{
2131 r: s.Repository,
2132 Filesystem: fs,
2133 }
2134
2135 err := w.Checkout(&CheckoutOptions{Force: true})
2136 c.Assert(err, IsNil)
2137
2138 hash, err := w.Remove("json")
2139 c.Assert(hash.IsZero(), Equals, true)
2140 c.Assert(err, IsNil)
2141
2142 status, err := w.Status()
2143 c.Assert(err, IsNil)
2144 c.Assert(status, HasLen, 2)
2145 c.Assert(status.File("json/long.json").Staging, Equals, Deleted)
2146 c.Assert(status.File("json/short.json").Staging, Equals, Deleted)
2147
2148 _, err = w.Filesystem.Stat("json")
2149 c.Assert(os.IsNotExist(err), Equals, true)
2150}
2151
2152func (s *WorktreeSuite) TestRemoveDirectoryUntracked(c *C) {
2153 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
RemoveMethod · 0.95
StatusMethod · 0.95
StatMethod · 0.80
IsZeroMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected