aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/reference.go15
-rw-r--r--core/storage.go4
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