MCPcopy
hub / github.com/go-git/go-git / TestRemoveDirectory

Method TestRemoveDirectory

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

Source from the content-addressed store, hash-verified

2384}
2385
2386func (s *WorktreeSuite) TestRemoveDirectory(c *C) {
2387 fs := memfs.New()
2388 w := &Worktree{
2389 r: s.Repository,
2390 Filesystem: fs,
2391 }
2392
2393 err := w.Checkout(&CheckoutOptions{Force: true})
2394 c.Assert(err, IsNil)
2395
2396 hash, err := w.Remove("json")
2397 c.Assert(hash.IsZero(), Equals, true)
2398 c.Assert(err, IsNil)
2399
2400 status, err := w.Status()
2401 c.Assert(err, IsNil)
2402 c.Assert(status, HasLen, 2)
2403 c.Assert(status.File("json/long.json").Staging, Equals, Deleted)
2404 c.Assert(status.File("json/short.json").Staging, Equals, Deleted)
2405
2406 _, err = w.Filesystem.Stat("json")
2407 c.Assert(os.IsNotExist(err), Equals, true)
2408}
2409
2410func (s *WorktreeSuite) TestRemoveDirectoryUntracked(c *C) {
2411 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected