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

Method objectPacks

storage/filesystem/dotgit/dotgit.go:241–268  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

239}
240
241func (d *DotGit) objectPacks() ([]plumbing.Hash, error) {
242 packDir := d.fs.Join(objectsPath, packPath)
243 files, err := d.fs.ReadDir(packDir)
244 if err != nil {
245 if os.IsNotExist(err) {
246 return nil, nil
247 }
248
249 return nil, err
250 }
251
252 var packs []plumbing.Hash
253 for _, f := range files {
254 n := f.Name()
255 if !strings.HasSuffix(n, packExt) || !strings.HasPrefix(n, packPrefix) {
256 continue
257 }
258
259 h := plumbing.NewHash(n[5 : len(n)-5]) // pack-(hash).pack
260 if h.IsZero() {
261 // Ignore files with badly-formatted names.
262 continue
263 }
264 packs = append(packs, h)
265 }
266
267 return packs, nil
268}
269
270func (d *DotGit) objectPackPath(hash plumbing.Hash, extension string) string {
271 return d.fs.Join(objectsPath, packPath, fmt.Sprintf("pack-%s.%s", hash.String(), extension))

Callers 2

ObjectPacksMethod · 0.95
genPackListMethod · 0.95

Calls 5

IsZeroMethod · 0.95
NewHashFunction · 0.92
JoinMethod · 0.80
NameMethod · 0.65
ReadDirMethod · 0.45

Tested by

no test coverage detected