MCPcopy
hub / github.com/go-git/go-git / TestAddRemoved

Method TestAddRemoved

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

Source from the content-addressed store, hash-verified

1771}
1772
1773func (s *WorktreeSuite) TestAddRemoved(c *C) {
1774 fs := memfs.New()
1775 w := &Worktree{
1776 r: s.Repository,
1777 Filesystem: fs,
1778 }
1779
1780 err := w.Checkout(&CheckoutOptions{Force: true})
1781 c.Assert(err, IsNil)
1782
1783 idx, err := w.r.Storer.Index()
1784 c.Assert(err, IsNil)
1785 c.Assert(idx.Entries, HasLen, 9)
1786
1787 err = w.Filesystem.Remove("LICENSE")
1788 c.Assert(err, IsNil)
1789
1790 hash, err := w.Add("LICENSE")
1791 c.Assert(err, IsNil)
1792 c.Assert(hash.String(), Equals, "c192bd6a24ea1ab01d78686e417c8bdc7c3d197f")
1793
1794 e, err := idx.Entry("LICENSE")
1795 c.Assert(err, IsNil)
1796 c.Assert(e.Hash, Equals, hash)
1797 c.Assert(e.Mode, Equals, filemode.Regular)
1798
1799 status, err := w.Status()
1800 c.Assert(err, IsNil)
1801 c.Assert(status, HasLen, 1)
1802
1803 file := status.File("LICENSE")
1804 c.Assert(file.Staging, Equals, Deleted)
1805}
1806
1807func (s *WorktreeSuite) TestAddRemovedInDirectory(c *C) {
1808 fs := memfs.New()

Callers

nothing calls this directly

Calls 8

CheckoutMethod · 0.95
AddMethod · 0.95
StatusMethod · 0.95
EntryMethod · 0.80
IndexMethod · 0.65
StringMethod · 0.65
RemoveMethod · 0.45
FileMethod · 0.45

Tested by

no test coverage detected