ForEachObjectHash iterates over the hashes of objects found under the .git/objects/ directory and executes the provided function.
(fun func(plumbing.Hash) error)
| 419 | // ForEachObjectHash iterates over the hashes of objects found under the |
| 420 | // .git/objects/ directory and executes the provided function. |
| 421 | func (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 | |
| 441 | func (d *DotGit) forEachObjectHash(fun func(plumbing.Hash) error) error { |
| 442 | files, err := d.fs.ReadDir(objectsPath) |
no test coverage detected