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

Method ForEachObjectHash

storage/filesystem/dotgit/dotgit.go:421–439  ·  view source on GitHub ↗

ForEachObjectHash iterates over the hashes of objects found under the .git/objects/ directory and executes the provided function.

(fun func(plumbing.Hash) error)

Source from the content-addressed store, hash-verified

419// ForEachObjectHash iterates over the hashes of objects found under the
420// .git/objects/ directory and executes the provided function.
421func (d *DotGit) ForEachObjectHash(fun func(plumbing.Hash) error) error {
422 if !d.options.ExclusiveAccess {
423 return d.forEachObjectHash(fun)
424 }
425
426 err := d.genObjectList()
427 if err != nil {
428 return err
429 }
430
431 for _, h := range d.objectList {
432 err := fun(h)
433 if err != nil {
434 return err
435 }
436 }
437
438 return nil
439}
440
441func (d *DotGit) forEachObjectHash(fun func(plumbing.Hash) error) error {
442 files, err := d.fs.ReadDir(objectsPath)

Callers 2

ObjectsWithPrefixMethod · 0.95
ObjectsMethod · 0.95

Calls 2

forEachObjectHashMethod · 0.95
genObjectListMethod · 0.95

Tested by

no test coverage detected