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

Method Objects

storage/filesystem/dotgit/dotgit.go:398–417  ·  view source on GitHub ↗

Objects returns a slice with the hashes of objects found under the .git/objects/ directory.

()

Source from the content-addressed store, hash-verified

396// Objects returns a slice with the hashes of objects found under the
397// .git/objects/ directory.
398func (d *DotGit) Objects() ([]plumbing.Hash, error) {
399 if d.options.ExclusiveAccess {
400 err := d.genObjectList()
401 if err != nil {
402 return nil, err
403 }
404
405 return d.objectList, nil
406 }
407
408 var objects []plumbing.Hash
409 err := d.ForEachObjectHash(func(hash plumbing.Hash) error {
410 objects = append(objects, hash)
411 return nil
412 })
413 if err != nil {
414 return nil, err
415 }
416 return objects, nil
417}
418
419// ForEachObjectHash iterates over the hashes of objects found under the
420// .git/objects/ directory and executes the provided function.

Callers 4

ObjectsWithPrefixMethod · 0.95
IterEncodedObjectsMethod · 0.45
testObjectsFunction · 0.45
TestObjectsNoFolderMethod · 0.45

Calls 2

genObjectListMethod · 0.95
ForEachObjectHashMethod · 0.95

Tested by 2

testObjectsFunction · 0.36
TestObjectsNoFolderMethod · 0.36