| 1968 | } |
| 1969 | |
| 1970 | func (s *WorktreeSuite) TestAddSkipStatusModifiedPath(c *C) { |
| 1971 | fs := memfs.New() |
| 1972 | w := &Worktree{ |
| 1973 | r: s.Repository, |
| 1974 | Filesystem: fs, |
| 1975 | } |
| 1976 | |
| 1977 | err := w.Checkout(&CheckoutOptions{Force: true}) |
| 1978 | c.Assert(err, IsNil) |
| 1979 | |
| 1980 | idx, err := w.r.Storer.Index() |
| 1981 | c.Assert(err, IsNil) |
| 1982 | c.Assert(idx.Entries, HasLen, 9) |
| 1983 | |
| 1984 | err = util.WriteFile(w.Filesystem, "LICENSE", []byte("file1"), 0644) |
| 1985 | c.Assert(err, IsNil) |
| 1986 | |
| 1987 | err = w.AddWithOptions(&AddOptions{Path: "LICENSE", SkipStatus: true}) |
| 1988 | c.Assert(err, IsNil) |
| 1989 | |
| 1990 | idx, err = w.r.Storer.Index() |
| 1991 | c.Assert(err, IsNil) |
| 1992 | c.Assert(idx.Entries, HasLen, 9) |
| 1993 | |
| 1994 | e, err := idx.Entry("LICENSE") |
| 1995 | c.Assert(err, IsNil) |
| 1996 | c.Assert(e.Mode, Equals, filemode.Regular) |
| 1997 | |
| 1998 | status, err := w.Status() |
| 1999 | c.Assert(err, IsNil) |
| 2000 | c.Assert(status, HasLen, 1) |
| 2001 | |
| 2002 | file := status.File("LICENSE") |
| 2003 | c.Assert(file.Staging, Equals, Modified) |
| 2004 | c.Assert(file.Worktree, Equals, Unmodified) |
| 2005 | } |
| 2006 | |
| 2007 | func (s *WorktreeSuite) TestAddSkipStatusNonModifiedPath(c *C) { |
| 2008 | fs := memfs.New() |