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

Function assertObjectPacks

plumbing/serverinfo/serverinfo_test.go:91–120  ·  view source on GitHub ↗
(c *C, st storage.Storer, fs billy.Filesystem)

Source from the content-addressed store, hash-verified

89}
90
91func assertObjectPacks(c *C, st storage.Storer, fs billy.Filesystem) {
92 infoPacks, err := fs.Open("objects/info/packs")
93 c.Assert(err, IsNil)
94
95 defer infoPacks.Close()
96 bts, err := io.ReadAll(infoPacks)
97 c.Assert(err, IsNil)
98
99 pos, ok := st.(storer.PackedObjectStorer)
100 c.Assert(ok, Equals, true)
101 localPacks := make(map[string]struct{})
102 packs, err := pos.ObjectPacks()
103 c.Assert(err, IsNil)
104
105 for _, line := range strings.Split(string(bts), "\n") {
106 if line == "" {
107 continue
108 }
109 parts := strings.Split(line, " ")
110 c.Assert(parts, HasLen, 2)
111 pack := strings.TrimPrefix(parts[1], "pack-")
112 pack = strings.TrimSuffix(pack, ".pack")
113 localPacks[pack] = struct{}{}
114 }
115
116 for _, p := range packs {
117 _, ok := localPacks[p.String()]
118 c.Assert(ok, Equals, true)
119 }
120}
121
122func (s *ServerInfoSuite) TestUpdateServerInfoTags(c *C) {
123 fs := memfs.New()

Calls 4

CloseMethod · 0.65
ObjectPacksMethod · 0.65
StringMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…