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

Method TestAddAndCommitWithSkipStatus

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

Source from the content-addressed store, hash-verified

280}
281
282func (s *WorktreeSuite) TestAddAndCommitWithSkipStatus(c *C) {
283 expected := plumbing.NewHash("375a3808ffde7f129cdd3c8c252fd0fe37cfd13b")
284
285 fs := memfs.New()
286 w := &Worktree{
287 r: s.Repository,
288 Filesystem: fs,
289 }
290
291 err := w.Checkout(&CheckoutOptions{})
292 c.Assert(err, IsNil)
293
294 util.WriteFile(fs, "LICENSE", []byte("foo"), 0644)
295 util.WriteFile(fs, "foo", []byte("foo"), 0644)
296
297 err = w.AddWithOptions(&AddOptions{
298 Path: "foo",
299 SkipStatus: true,
300 })
301 c.Assert(err, IsNil)
302
303 hash, err := w.Commit("commit foo only\n", &CommitOptions{
304 Author: defaultSignature(),
305 })
306
307 c.Assert(hash, Equals, expected)
308 c.Assert(err, IsNil)
309
310 assertStorageStatus(c, s.Repository, 13, 11, 10, expected)
311}
312
313func (s *WorktreeSuite) TestAddAndCommitWithSkipStatusPathNotModified(c *C) {
314 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