MCPcopy Index your code
hub / github.com/go-git/go-git / TestAddSkipStatusNonModifiedPath

Method TestAddSkipStatusNonModifiedPath

worktree_test.go:2265–2297  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

2263}
2264
2265func (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
2299func (s *WorktreeSuite) TestAddSkipStatusWithIgnoredPath(c *C) {
2300 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
AddWithOptionsMethod · 0.95
StatusMethod · 0.95
EntryMethod · 0.80
IndexMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected