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

Method TestAddSymlink

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

Source from the content-addressed store, hash-verified

1940}
1941
1942func (s *WorktreeSuite) TestAddSymlink(c *C) {
1943 dir := c.MkDir()
1944
1945 r, err := PlainInit(dir, false)
1946 c.Assert(err, IsNil)
1947 err = util.WriteFile(r.wt, "foo", []byte("qux"), 0644)
1948 c.Assert(err, IsNil)
1949 err = r.wt.Symlink("foo", "bar")
1950 c.Assert(err, IsNil)
1951
1952 w, err := r.Worktree()
1953 c.Assert(err, IsNil)
1954 h, err := w.Add("foo")
1955 c.Assert(err, IsNil)
1956 c.Assert(h, Not(Equals), plumbing.NewHash("19102815663d23f8b75a47e7a01965dcdc96468c"))
1957
1958 h, err = w.Add("bar")
1959 c.Assert(err, IsNil)
1960 c.Assert(h, Equals, plumbing.NewHash("19102815663d23f8b75a47e7a01965dcdc96468c"))
1961
1962 obj, err := w.r.Storer.EncodedObject(plumbing.BlobObject, h)
1963 c.Assert(err, IsNil)
1964 c.Assert(obj, NotNil)
1965 c.Assert(obj.Size(), Equals, int64(3))
1966}
1967
1968func (s *WorktreeSuite) TestAddDirectory(c *C) {
1969 fs := memfs.New()

Callers

nothing calls this directly

Calls 7

NewHashFunction · 0.92
PlainInitFunction · 0.85
WorktreeMethod · 0.80
EncodedObjectMethod · 0.65
SizeMethod · 0.65
SymlinkMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected