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

Method TestRemoveDirectoryUntracked

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

Source from the content-addressed store, hash-verified

2408}
2409
2410func (s *WorktreeSuite) TestRemoveDirectoryUntracked(c *C) {
2411 fs := memfs.New()
2412 w := &Worktree{
2413 r: s.Repository,
2414 Filesystem: fs,
2415 }
2416
2417 err := w.Checkout(&CheckoutOptions{Force: true})
2418 c.Assert(err, IsNil)
2419
2420 err = util.WriteFile(w.Filesystem, "json/foo", []byte("FOO"), 0755)
2421 c.Assert(err, IsNil)
2422
2423 hash, err := w.Remove("json")
2424 c.Assert(hash.IsZero(), Equals, true)
2425 c.Assert(err, IsNil)
2426
2427 status, err := w.Status()
2428 c.Assert(err, IsNil)
2429 c.Assert(status, HasLen, 3)
2430 c.Assert(status.File("json/long.json").Staging, Equals, Deleted)
2431 c.Assert(status.File("json/short.json").Staging, Equals, Deleted)
2432 c.Assert(status.File("json/foo").Staging, Equals, Untracked)
2433
2434 _, err = w.Filesystem.Stat("json")
2435 c.Assert(err, IsNil)
2436}
2437
2438func (s *WorktreeSuite) TestRemoveDeletedFromWorktree(c *C) {
2439 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