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

Method TestIgnored

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

Source from the content-addressed store, hash-verified

1460}
1461
1462func (s *WorktreeSuite) TestIgnored(c *C) {
1463 fs := memfs.New()
1464 w := &Worktree{
1465 r: s.Repository,
1466 Filesystem: fs,
1467 }
1468
1469 w.Excludes = make([]gitignore.Pattern, 0)
1470 w.Excludes = append(w.Excludes, gitignore.ParsePattern("foo", nil))
1471
1472 err := w.Checkout(&CheckoutOptions{Force: true})
1473 c.Assert(err, IsNil)
1474
1475 idx, err := w.r.Storer.Index()
1476 c.Assert(err, IsNil)
1477 c.Assert(idx.Entries, HasLen, 9)
1478
1479 err = util.WriteFile(w.Filesystem, "foo", []byte("FOO"), 0755)
1480 c.Assert(err, IsNil)
1481
1482 status, err := w.Status()
1483 c.Assert(err, IsNil)
1484 c.Assert(status, HasLen, 0)
1485
1486 file := status.File("foo")
1487 c.Assert(file.Staging, Equals, Untracked)
1488 c.Assert(file.Worktree, Equals, Untracked)
1489}
1490
1491func (s *WorktreeSuite) TestExcludedNoGitignore(c *C) {
1492 f := fixtures.ByTag("empty").One()

Callers

nothing calls this directly

Calls 5

CheckoutMethod · 0.95
StatusMethod · 0.95
ParsePatternFunction · 0.92
IndexMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected