MCPcopy Index your code
hub / github.com/go-git/go-git / TestRemove

Method TestRemove

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

Source from the content-addressed store, hash-verified

2349}
2350
2351func (s *WorktreeSuite) TestRemove(c *C) {
2352 fs := memfs.New()
2353 w := &Worktree{
2354 r: s.Repository,
2355 Filesystem: fs,
2356 }
2357
2358 err := w.Checkout(&CheckoutOptions{Force: true})
2359 c.Assert(err, IsNil)
2360
2361 hash, err := w.Remove("LICENSE")
2362 c.Assert(hash.String(), Equals, "c192bd6a24ea1ab01d78686e417c8bdc7c3d197f")
2363 c.Assert(err, IsNil)
2364
2365 status, err := w.Status()
2366 c.Assert(err, IsNil)
2367 c.Assert(status, HasLen, 1)
2368 c.Assert(status.File("LICENSE").Staging, Equals, Deleted)
2369}
2370
2371func (s *WorktreeSuite) TestRemoveNotExistentEntry(c *C) {
2372 fs := memfs.New()

Callers

nothing calls this directly

Calls 5

CheckoutMethod · 0.95
RemoveMethod · 0.95
StatusMethod · 0.95
StringMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected