| 2263 | } |
| 2264 | |
| 2265 | func (s *WorktreeSuite) TestAddSkipStatusNonModifiedPath(c *C) { |
| 2266 | fs := memfs.New() |
| 2267 | w := &Worktree{ |
| 2268 | r: s.Repository, |
| 2269 | Filesystem: fs, |
| 2270 | } |
| 2271 | |
| 2272 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 2273 | c.Assert(err, IsNil) |
| 2274 | |
| 2275 | idx, err := w.r.Storer.Index() |
| 2276 | c.Assert(err, IsNil) |
| 2277 | c.Assert(idx.Entries, HasLen, 9) |
| 2278 | |
| 2279 | err = w.AddWithOptions(&AddOptions{Path: "LICENSE", SkipStatus: true}) |
| 2280 | c.Assert(err, IsNil) |
| 2281 | |
| 2282 | idx, err = w.r.Storer.Index() |
| 2283 | c.Assert(err, IsNil) |
| 2284 | c.Assert(idx.Entries, HasLen, 9) |
| 2285 | |
| 2286 | e, err := idx.Entry("LICENSE") |
| 2287 | c.Assert(err, IsNil) |
| 2288 | c.Assert(e.Mode, Equals, filemode.Regular) |
| 2289 | |
| 2290 | status, err := w.Status() |
| 2291 | c.Assert(err, IsNil) |
| 2292 | c.Assert(status, HasLen, 0) |
| 2293 | |
| 2294 | file := status.File("LICENSE") |
| 2295 | c.Assert(file.Staging, Equals, Untracked) |
| 2296 | c.Assert(file.Worktree, Equals, Untracked) |
| 2297 | } |
| 2298 | |
| 2299 | func (s *WorktreeSuite) TestAddSkipStatusWithIgnoredPath(c *C) { |
| 2300 | fs := memfs.New() |