diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-14 18:21:10 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-14 18:21:10 +0200 |
commit | f6fe29c80d11662a169806dcf413ecdedcb28fa3 (patch) | |
tree | 9958034c27521f720f8c5d83c12120ada196f48a /core | |
parent | 91bf16b2336e6f80f0742be729582fe5fbbada83 (diff) | |
download | go-git-f6fe29c80d11662a169806dcf413ecdedcb28fa3.tar.gz |
core: Storage, removing err returning *Storages
Diffstat (limited to 'core')
-rw-r--r-- | core/reference.go | 15 | ||||
-rw-r--r-- | core/storage.go | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/core/reference.go b/core/reference.go index 7d3f378..3ec95a0 100644 --- a/core/reference.go +++ b/core/reference.go @@ -132,6 +132,21 @@ func (r *Reference) IsTag() bool { return strings.HasPrefix(string(r.n), refTagPrefix) } +// Strings dump a reference as a [2]string +func (r *Reference) Strings() [2]string { + var o [2]string + o[0] = r.Name().String() + + switch r.Type() { + case HashReference: + o[1] = r.Hash().String() + case SymbolicReference: + o[1] = symrefPrefix + r.Target().String() + } + + return o +} + // ReferenceSliceIter implements ReferenceIter. It iterates over a series of // references stored in a slice and yields each one in turn when Next() is // called. diff --git a/core/storage.go b/core/storage.go index 70a47e6..cb8f45d 100644 --- a/core/storage.go +++ b/core/storage.go @@ -2,8 +2,8 @@ package core // Storage storage of objects and references type Storage interface { - ObjectStorage() (ObjectStorage, error) - ReferenceStorage() (ReferenceStorage, error) + ObjectStorage() ObjectStorage + ReferenceStorage() ReferenceStorage } // ObjectStorage generic storage of objects |