| 2408 | } |
| 2409 | |
| 2410 | func (s *WorktreeSuite) TestRemoveDirectoryUntracked(c *C) { |
| 2411 | fs := memfs.New() |
| 2412 | w := &Worktree{ |
| 2413 | r: s.Repository, |
| 2414 | Filesystem: fs, |
| 2415 | } |
| 2416 | |
| 2417 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 2418 | c.Assert(err, IsNil) |
| 2419 | |
| 2420 | err = util.WriteFile(w.Filesystem, "json/foo", []byte("FOO"), 0755) |
| 2421 | c.Assert(err, IsNil) |
| 2422 | |
| 2423 | hash, err := w.Remove("json") |
| 2424 | c.Assert(hash.IsZero(), Equals, true) |
| 2425 | c.Assert(err, IsNil) |
| 2426 | |
| 2427 | status, err := w.Status() |
| 2428 | c.Assert(err, IsNil) |
| 2429 | c.Assert(status, HasLen, 3) |
| 2430 | c.Assert(status.File("json/long.json").Staging, Equals, Deleted) |
| 2431 | c.Assert(status.File("json/short.json").Staging, Equals, Deleted) |
| 2432 | c.Assert(status.File("json/foo").Staging, Equals, Untracked) |
| 2433 | |
| 2434 | _, err = w.Filesystem.Stat("json") |
| 2435 | c.Assert(err, IsNil) |
| 2436 | } |
| 2437 | |
| 2438 | func (s *WorktreeSuite) TestRemoveDeletedFromWorktree(c *C) { |
| 2439 | fs := memfs.New() |