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