(c *C)
| 2023 | } |
| 2024 | |
| 2025 | func (s *WorktreeSuite) TestAddAll(c *C) { |
| 2026 | fs := memfs.New() |
| 2027 | w := &Worktree{ |
| 2028 | r: s.Repository, |
| 2029 | Filesystem: fs, |
| 2030 | } |
| 2031 | |
| 2032 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 2033 | c.Assert(err, IsNil) |
| 2034 | |
| 2035 | idx, err := w.r.Storer.Index() |
| 2036 | c.Assert(err, IsNil) |
| 2037 | c.Assert(idx.Entries, HasLen, 9) |
| 2038 | |
| 2039 | err = util.WriteFile(w.Filesystem, "file1", []byte("file1"), 0644) |
| 2040 | c.Assert(err, IsNil) |
| 2041 | |
| 2042 | err = util.WriteFile(w.Filesystem, "file2", []byte("file2"), 0644) |
| 2043 | c.Assert(err, IsNil) |
| 2044 | |
| 2045 | err = util.WriteFile(w.Filesystem, "file3", []byte("ignore me"), 0644) |
| 2046 | c.Assert(err, IsNil) |
| 2047 | |
| 2048 | w.Excludes = make([]gitignore.Pattern, 0) |
| 2049 | w.Excludes = append(w.Excludes, gitignore.ParsePattern("file3", nil)) |
| 2050 | |
| 2051 | err = w.AddWithOptions(&AddOptions{All: true}) |
| 2052 | c.Assert(err, IsNil) |
| 2053 | |
| 2054 | idx, err = w.r.Storer.Index() |
| 2055 | c.Assert(err, IsNil) |
| 2056 | c.Assert(idx.Entries, HasLen, 11) |
| 2057 | |
| 2058 | status, err := w.Status() |
| 2059 | c.Assert(err, IsNil) |
| 2060 | c.Assert(status, HasLen, 2) |
| 2061 | |
| 2062 | file1 := status.File("file1") |
| 2063 | c.Assert(file1.Staging, Equals, Added) |
| 2064 | file2 := status.File("file2") |
| 2065 | c.Assert(file2.Staging, Equals, Added) |
| 2066 | file3 := status.File("file3") |
| 2067 | c.Assert(file3.Staging, Equals, Untracked) |
| 2068 | c.Assert(file3.Worktree, Equals, Untracked) |
| 2069 | } |
| 2070 | |
| 2071 | func (s *WorktreeSuite) TestAddGlob(c *C) { |
| 2072 | fs := memfs.New() |
nothing calls this directly
no test coverage detected