| 1931 | } |
| 1932 | |
| 1933 | func (s *WorktreeSuite) TestAddSkipStatusAddedPath(c *C) { |
| 1934 | fs := memfs.New() |
| 1935 | w := &Worktree{ |
| 1936 | r: s.Repository, |
| 1937 | Filesystem: fs, |
| 1938 | } |
| 1939 | |
| 1940 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 1941 | c.Assert(err, IsNil) |
| 1942 | |
| 1943 | idx, err := w.r.Storer.Index() |
| 1944 | c.Assert(err, IsNil) |
| 1945 | c.Assert(idx.Entries, HasLen, 9) |
| 1946 | |
| 1947 | err = util.WriteFile(w.Filesystem, "file1", []byte("file1"), 0644) |
| 1948 | c.Assert(err, IsNil) |
| 1949 | |
| 1950 | err = w.AddWithOptions(&AddOptions{Path: "file1", SkipStatus: true}) |
| 1951 | c.Assert(err, IsNil) |
| 1952 | |
| 1953 | idx, err = w.r.Storer.Index() |
| 1954 | c.Assert(err, IsNil) |
| 1955 | c.Assert(idx.Entries, HasLen, 10) |
| 1956 | |
| 1957 | e, err := idx.Entry("file1") |
| 1958 | c.Assert(err, IsNil) |
| 1959 | c.Assert(e.Mode, Equals, filemode.Regular) |
| 1960 | |
| 1961 | status, err := w.Status() |
| 1962 | c.Assert(err, IsNil) |
| 1963 | c.Assert(status, HasLen, 1) |
| 1964 | |
| 1965 | file := status.File("file1") |
| 1966 | c.Assert(file.Staging, Equals, Added) |
| 1967 | c.Assert(file.Worktree, Equals, Unmodified) |
| 1968 | } |
| 1969 | |
| 1970 | func (s *WorktreeSuite) TestAddSkipStatusModifiedPath(c *C) { |
| 1971 | fs := memfs.New() |