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

Method TestDecodeCacheTree

plumbing/format/index/decoder_test.go:66–86  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

64}
65
66func (s *IndexSuite) TestDecodeCacheTree(c *C) {
67 f, err := fixtures.Basic().One().DotGit().Open("index")
68 c.Assert(err, IsNil)
69 defer func() { c.Assert(f.Close(), IsNil) }()
70
71 idx := &Index{}
72 d := NewDecoder(f)
73 err = d.Decode(idx)
74 c.Assert(err, IsNil)
75
76 c.Assert(idx.Entries, HasLen, 9)
77 c.Assert(idx.Cache.Entries, HasLen, 5)
78
79 for i, expected := range expectedEntries {
80 c.Assert(idx.Cache.Entries[i].Path, Equals, expected.Path)
81 c.Assert(idx.Cache.Entries[i].Entries, Equals, expected.Entries)
82 c.Assert(idx.Cache.Entries[i].Trees, Equals, expected.Trees)
83 c.Assert(idx.Cache.Entries[i].Hash.String(), Equals, expected.Hash.String())
84 }
85
86}
87
88var expectedEntries = []TreeEntry{
89 {Path: "", Entries: 9, Trees: 4, Hash: plumbing.NewHash("a8d315b2b1c615d43042c3a62402b8a54288cf5c")},

Callers

nothing calls this directly

Calls 5

DecodeMethod · 0.95
NewDecoderFunction · 0.70
CloseMethod · 0.65
StringMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected