aboutsummaryrefslogtreecommitdiffstats
path: root/storage/memory/storage.go
diff options
context:
space:
mode:
Diffstat (limited to 'storage/memory/storage.go')
-rw-r--r--storage/memory/storage.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go
index fa9a4fa..92aeec9 100644
--- a/storage/memory/storage.go
+++ b/storage/memory/storage.go
@@ -220,6 +220,11 @@ func (r ReferenceStorage) IterReferences() (storer.ReferenceIter, error) {
return storer.NewReferenceSliceIter(refs), nil
}
+func (r ReferenceStorage) RemoveReference(n plumbing.ReferenceName) error {
+ delete(r, n)
+ return nil
+}
+
type ShallowStorage []plumbing.Hash
func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error {
@@ -234,9 +239,12 @@ func (s ShallowStorage) Shallow() ([]plumbing.Hash, error) {
type ModuleStorage map[string]*Storage
func (s ModuleStorage) Module(name string) (storage.Storer, error) {
- if _, ok := s[name]; !ok {
- s[name] = NewStorage()
+ if m, ok := s[name]; ok {
+ return m, nil
}
- return s[name], nil
+ m := NewStorage()
+ s[name] = m
+
+ return m, nil
}