| 2527 | } |
| 2528 | |
| 2529 | func (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 | |
| 2550 | func (s *WorktreeSuite) TestMoveNotExistentEntry(c *C) { |
| 2551 | fs := memfs.New() |