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

Method TestAddSkipStatusAddedPath

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

Source from the content-addressed store, hash-verified

2189}
2190
2191func (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
2228func (s *WorktreeSuite) TestAddSkipStatusModifiedPath(c *C) {
2229 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