MCPcopy Index your code
hub / github.com/go-git/go-git / TestAddRemovedInDirectoryDot

Method TestAddRemovedInDirectoryDot

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

Source from the content-addressed store, hash-verified

1895}
1896
1897func (s *WorktreeSuite) TestAddRemovedInDirectoryDot(c *C) {
1898 fs := memfs.New()
1899 w := &Worktree{
1900 r: s.Repository,
1901 Filesystem: fs,
1902 }
1903
1904 err := w.Checkout(&CheckoutOptions{Force: true})
1905 c.Assert(err, IsNil)
1906
1907 idx, err := w.r.Storer.Index()
1908 c.Assert(err, IsNil)
1909 c.Assert(idx.Entries, HasLen, 9)
1910
1911 err = w.Filesystem.Remove("go/example.go")
1912 c.Assert(err, IsNil)
1913
1914 err = w.Filesystem.Remove("json/short.json")
1915 c.Assert(err, IsNil)
1916
1917 hash, err := w.Add(".")
1918 c.Assert(err, IsNil)
1919 c.Assert(hash.IsZero(), Equals, true)
1920
1921 e, err := idx.Entry("go/example.go")
1922 c.Assert(err, IsNil)
1923 c.Assert(e.Hash, Equals, plumbing.NewHash("880cd14280f4b9b6ed3986d6671f907d7cc2a198"))
1924 c.Assert(e.Mode, Equals, filemode.Regular)
1925
1926 e, err = idx.Entry("json/short.json")
1927 c.Assert(err, IsNil)
1928 c.Assert(e.Hash, Equals, plumbing.NewHash("c8f1d8c61f9da76f4cb49fd86322b6e685dba956"))
1929 c.Assert(e.Mode, Equals, filemode.Regular)
1930
1931 status, err := w.Status()
1932 c.Assert(err, IsNil)
1933 c.Assert(status, HasLen, 2)
1934
1935 file := status.File("go/example.go")
1936 c.Assert(file.Staging, Equals, Deleted)
1937
1938 file = status.File("json/short.json")
1939 c.Assert(file.Staging, Equals, Deleted)
1940}
1941
1942func (s *WorktreeSuite) TestAddSymlink(c *C) {
1943 dir := c.MkDir()

Callers

nothing calls this directly

Calls 9

CheckoutMethod · 0.95
AddMethod · 0.95
StatusMethod · 0.95
NewHashFunction · 0.92
EntryMethod · 0.80
IndexMethod · 0.65
IsZeroMethod · 0.65
RemoveMethod · 0.45
FileMethod · 0.45

Tested by

no test coverage detected