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

Method TestMove

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

Source from the content-addressed store, hash-verified

2269}
2270
2271func (s *WorktreeSuite) TestMove(c *C) {
2272 fs := memfs.New()
2273 w := &Worktree{
2274 r: s.Repository,
2275 Filesystem: fs,
2276 }
2277
2278 err := w.Checkout(&CheckoutOptions{Force: true})
2279 c.Assert(err, IsNil)
2280
2281 hash, err := w.Move("LICENSE", "foo")
2282 c.Check(hash.String(), Equals, "c192bd6a24ea1ab01d78686e417c8bdc7c3d197f")
2283 c.Assert(err, IsNil)
2284
2285 status, err := w.Status()
2286 c.Assert(err, IsNil)
2287 c.Assert(status, HasLen, 2)
2288 c.Assert(status.File("LICENSE").Staging, Equals, Deleted)
2289 c.Assert(status.File("foo").Staging, Equals, Added)
2290
2291}
2292
2293func (s *WorktreeSuite) TestMoveNotExistentEntry(c *C) {
2294 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
MoveMethod · 0.95
StatusMethod · 0.95
StringMethod · 0.65
CheckMethod · 0.45
FileMethod · 0.45

Tested by

no test coverage detected