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

Method TestIgnored

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

Source from the content-addressed store, hash-verified

1660}
1661
1662func (s *WorktreeSuite) TestIgnored(c *C) {
1663 fs := memfs.New()
1664 w := &Worktree{
1665 r: s.Repository,
1666 Filesystem: fs,
1667 }
1668
1669 w.Excludes = make([]gitignore.Pattern, 0)
1670 w.Excludes = append(w.Excludes, gitignore.ParsePattern("foo", nil))
1671
1672 err := w.Checkout(&CheckoutOptions{Force: true})
1673 c.Assert(err, IsNil)
1674
1675 idx, err := w.r.Storer.Index()
1676 c.Assert(err, IsNil)
1677 c.Assert(idx.Entries, HasLen, 9)
1678
1679 err = util.WriteFile(w.Filesystem, "foo", []byte("FOO"), 0755)
1680 c.Assert(err, IsNil)
1681
1682 status, err := w.Status()
1683 c.Assert(err, IsNil)
1684 c.Assert(status, HasLen, 0)
1685
1686 file := status.File("foo")
1687 c.Assert(file.Staging, Equals, Untracked)
1688 c.Assert(file.Worktree, Equals, Untracked)
1689}
1690
1691func (s *WorktreeSuite) TestExcludedNoGitignore(c *C) {
1692 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