MCPcopy Create free account
hub / github.com/go-git/go-git / TestAddSkipStatusAddedPath

Method TestAddSkipStatusAddedPath

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

Source from the content-addressed store, hash-verified

1931}
1932
1933func (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
1970func (s *WorktreeSuite) TestAddSkipStatusModifiedPath(c *C) {
1971 fs := memfs.New()

Callers

nothing calls this directly

Calls 6

CheckoutMethod · 0.95
AddWithOptionsMethod · 0.95
StatusMethod · 0.95
EntryMethod · 0.80
IndexMethod · 0.65
FileMethod · 0.45

Tested by

no test coverage detected