| 2269 | } |
| 2270 | |
| 2271 | func (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 | |
| 2293 | func (s *WorktreeSuite) TestMoveNotExistentEntry(c *C) { |
| 2294 | fs := memfs.New() |