| 2189 | } |
| 2190 | |
| 2191 | func (s *WorktreeSuite) TestAddSkipStatusAddedPath(c *C) { |
| 2192 | fs := memfs.New() |
| 2193 | w := &Worktree{ |
| 2194 | r: s.Repository, |
| 2195 | Filesystem: fs, |
| 2196 | } |
| 2197 | |
| 2198 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 2199 | c.Assert(err, IsNil) |
| 2200 | |
| 2201 | idx, err := w.r.Storer.Index() |
| 2202 | c.Assert(err, IsNil) |
| 2203 | c.Assert(idx.Entries, HasLen, 9) |
| 2204 | |
| 2205 | err = util.WriteFile(w.Filesystem, "file1", []byte("file1"), 0644) |
| 2206 | c.Assert(err, IsNil) |
| 2207 | |
| 2208 | err = w.AddWithOptions(&AddOptions{Path: "file1", SkipStatus: true}) |
| 2209 | c.Assert(err, IsNil) |
| 2210 | |
| 2211 | idx, err = w.r.Storer.Index() |
| 2212 | c.Assert(err, IsNil) |
| 2213 | c.Assert(idx.Entries, HasLen, 10) |
| 2214 | |
| 2215 | e, err := idx.Entry("file1") |
| 2216 | c.Assert(err, IsNil) |
| 2217 | c.Assert(e.Mode, Equals, filemode.Regular) |
| 2218 | |
| 2219 | status, err := w.Status() |
| 2220 | c.Assert(err, IsNil) |
| 2221 | c.Assert(status, HasLen, 1) |
| 2222 | |
| 2223 | file := status.File("file1") |
| 2224 | c.Assert(file.Staging, Equals, Added) |
| 2225 | c.Assert(file.Worktree, Equals, Unmodified) |
| 2226 | } |
| 2227 | |
| 2228 | func (s *WorktreeSuite) TestAddSkipStatusModifiedPath(c *C) { |
| 2229 | fs := memfs.New() |