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

Method TestMove

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

Source from the content-addressed store, hash-verified

2527}
2528
2529func (s *WorktreeSuite) TestMove(c *C) {
2530 fs := memfs.New()
2531 w := &Worktree{
2532 r: s.Repository,
2533 Filesystem: fs,
2534 }
2535
2536 err := w.Checkout(&CheckoutOptions{Force: true})
2537 c.Assert(err, IsNil)
2538
2539 hash, err := w.Move("LICENSE", "foo")
2540 c.Check(hash.String(), Equals, "c192bd6a24ea1ab01d78686e417c8bdc7c3d197f")
2541 c.Assert(err, IsNil)
2542
2543 status, err := w.Status()
2544 c.Assert(err, IsNil)
2545 c.Assert(status, HasLen, 2)
2546 c.Assert(status.File("LICENSE").Staging, Equals, Deleted)
2547 c.Assert(status.File("foo").Staging, Equals, Added)
2548}
2549
2550func (s *WorktreeSuite) TestMoveNotExistentEntry(c *C) {
2551 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