| 2005 | } |
| 2006 | |
| 2007 | func (s *WorktreeSuite) TestAddSkipStatusNonModifiedPath(c *C) { |
| 2008 | fs := memfs.New() |
| 2009 | w := &Worktree{ |
| 2010 | r: s.Repository, |
| 2011 | Filesystem: fs, |
| 2012 | } |
| 2013 | |
| 2014 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 2015 | c.Assert(err, IsNil) |
| 2016 | |
| 2017 | idx, err := w.r.Storer.Index() |
| 2018 | c.Assert(err, IsNil) |
| 2019 | c.Assert(idx.Entries, HasLen, 9) |
| 2020 | |
| 2021 | err = w.AddWithOptions(&AddOptions{Path: "LICENSE", SkipStatus: true}) |
| 2022 | c.Assert(err, IsNil) |
| 2023 | |
| 2024 | idx, err = w.r.Storer.Index() |
| 2025 | c.Assert(err, IsNil) |
| 2026 | c.Assert(idx.Entries, HasLen, 9) |
| 2027 | |
| 2028 | e, err := idx.Entry("LICENSE") |
| 2029 | c.Assert(err, IsNil) |
| 2030 | c.Assert(e.Mode, Equals, filemode.Regular) |
| 2031 | |
| 2032 | status, err := w.Status() |
| 2033 | c.Assert(err, IsNil) |
| 2034 | c.Assert(status, HasLen, 0) |
| 2035 | |
| 2036 | file := status.File("LICENSE") |
| 2037 | c.Assert(file.Staging, Equals, Untracked) |
| 2038 | c.Assert(file.Worktree, Equals, Untracked) |
| 2039 | } |
| 2040 | |
| 2041 | func (s *WorktreeSuite) TestAddSkipStatusWithIgnoredPath(c *C) { |
| 2042 | fs := memfs.New() |