aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-22 23:41:48 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-22 23:41:48 +0200
commit5913aee5004ff5b32c7926dda3af1f946d203f33 (patch)
treec9b3ce9e4439faf0313749690a3a0e496e32447d /repository.go
parent001bb130fe6186421f3ddcc556854410edd8d95e (diff)
downloadgo-git-5913aee5004ff5b32c7926dda3af1f946d203f33.tar.gz
test coverage improved, Remote.Refs and Repository.Refs returns error, TreeWalker -> TreeIter
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/repository.go b/repository.go
index 11b7fae..4d6b4e3 100644
--- a/repository.go
+++ b/repository.go
@@ -178,8 +178,13 @@ func (r *Repository) createReferences(ref *core.Reference) error {
// IsEmpty returns true if the repository is empty
func (r *Repository) IsEmpty() (bool, error) {
+ iter, err := r.Refs()
+ if err != nil {
+ return false, err
+ }
+
var count int
- return count == 0, r.Refs().ForEach(func(r *core.Reference) error {
+ return count == 0, iter.ForEach(func(r *core.Reference) error {
count++
return nil
})
@@ -328,11 +333,6 @@ func (r *Repository) Ref(name core.ReferenceName, resolved bool) (*core.Referenc
}
// Refs returns a map with all the References
-func (r *Repository) Refs() core.ReferenceIter {
- i, err := r.s.ReferenceStorage().Iter()
- if err != nil {
- panic(err)
- }
-
- return i
+func (r *Repository) Refs() (core.ReferenceIter, error) {
+ return r.s.ReferenceStorage().Iter()
}