(c *C)
| 1824 | } |
| 1825 | |
| 1826 | func (s *WorktreeSuite) TestAddAll(c *C) { |
| 1827 | fs := memfs.New() |
| 1828 | w := &Worktree{ |
| 1829 | r: s.Repository, |
| 1830 | Filesystem: fs, |
| 1831 | } |
| 1832 | |
| 1833 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 1834 | c.Assert(err, IsNil) |
| 1835 | |
| 1836 | idx, err := w.r.Storer.Index() |
| 1837 | c.Assert(err, IsNil) |
| 1838 | c.Assert(idx.Entries, HasLen, 9) |
| 1839 | |
| 1840 | err = util.WriteFile(w.Filesystem, "file1", []byte("file1"), 0644) |
| 1841 | c.Assert(err, IsNil) |
| 1842 | |
| 1843 | err = util.WriteFile(w.Filesystem, "file2", []byte("file2"), 0644) |
| 1844 | c.Assert(err, IsNil) |
| 1845 | |
| 1846 | err = util.WriteFile(w.Filesystem, "file3", []byte("ignore me"), 0644) |
| 1847 | c.Assert(err, IsNil) |
| 1848 | |
| 1849 | w.Excludes = make([]gitignore.Pattern, 0) |
| 1850 | w.Excludes = append(w.Excludes, gitignore.ParsePattern("file3", nil)) |
| 1851 | |
| 1852 | err = w.AddWithOptions(&AddOptions{All: true}) |
| 1853 | c.Assert(err, IsNil) |
| 1854 | |
| 1855 | idx, err = w.r.Storer.Index() |
| 1856 | c.Assert(err, IsNil) |
| 1857 | c.Assert(idx.Entries, HasLen, 11) |
| 1858 | |
| 1859 | status, err := w.Status() |
| 1860 | c.Assert(err, IsNil) |
| 1861 | c.Assert(status, HasLen, 2) |
| 1862 | |
| 1863 | file1 := status.File("file1") |
| 1864 | c.Assert(file1.Staging, Equals, Added) |
| 1865 | file2 := status.File("file2") |
| 1866 | c.Assert(file2.Staging, Equals, Added) |
| 1867 | file3 := status.File("file3") |
| 1868 | c.Assert(file3.Staging, Equals, Untracked) |
| 1869 | c.Assert(file3.Worktree, Equals, Untracked) |
| 1870 | } |
| 1871 | |
| 1872 | func (s *WorktreeSuite) TestAddGlob(c *C) { |
| 1873 | fs := memfs.New() |
nothing calls this directly
no test coverage detected