MCPcopy Create free account
hub / github.com/go-git/go-git / TestAddAndCommitWithSkipStatus

Method TestAddAndCommitWithSkipStatus

worktree_commit_test.go:167–196  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

165}
166
167func (s *WorktreeSuite) TestAddAndCommitWithSkipStatus(c *C) {
168 expected := plumbing.NewHash("375a3808ffde7f129cdd3c8c252fd0fe37cfd13b")
169
170 fs := memfs.New()
171 w := &Worktree{
172 r: s.Repository,
173 Filesystem: fs,
174 }
175
176 err := w.Checkout(&CheckoutOptions{})
177 c.Assert(err, IsNil)
178
179 util.WriteFile(fs, "LICENSE", []byte("foo"), 0644)
180 util.WriteFile(fs, "foo", []byte("foo"), 0644)
181
182 err = w.AddWithOptions(&AddOptions{
183 Path: "foo",
184 SkipStatus: true,
185 })
186 c.Assert(err, IsNil)
187
188 hash, err := w.Commit("commit foo only\n", &CommitOptions{
189 Author: defaultSignature(),
190 })
191
192 c.Assert(hash, Equals, expected)
193 c.Assert(err, IsNil)
194
195 assertStorageStatus(c, s.Repository, 13, 11, 10, expected)
196}
197
198func (s *WorktreeSuite) TestAddAndCommitWithSkipStatusPathNotModified(c *C) {
199 expected := plumbing.NewHash("375a3808ffde7f129cdd3c8c252fd0fe37cfd13b")

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
AddWithOptionsMethod · 0.95
CommitMethod · 0.95
NewHashFunction · 0.92
defaultSignatureFunction · 0.85
assertStorageStatusFunction · 0.85

Tested by

no test coverage detected