aboutsummaryrefslogtreecommitdiffstats
path: root/storage/memory
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-12-10 14:46:45 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2018-12-10 14:46:45 +0100
commita2b39f540e5b07cf361b530e19de30707b8ca0d7 (patch)
tree6cb4cefebd27d4bc3684771370ff00d7e940c0d7 /storage/memory
parent3052df3d6cc39257d1c9d938ddfb5b862b913999 (diff)
downloadgo-git-a2b39f540e5b07cf361b530e19de30707b8ca0d7.tar.gz
storage: new storage.ErrReferenceHasChanged error and test for CheckAndSetReference
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'storage/memory')
-rw-r--r--storage/memory/storage.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go
index 6e11742..f240f2a 100644
--- a/storage/memory/storage.go
+++ b/storage/memory/storage.go
@@ -13,7 +13,6 @@ import (
)
var ErrUnsupportedObjectType = fmt.Errorf("unsupported object type")
-var ErrRefHasChanged = fmt.Errorf("reference has changed concurrently")
// Storage is an implementation of git.Storer that stores data on memory, being
// ephemeral. The use of this storage should be done in controlled envoriments,
@@ -258,7 +257,7 @@ func (r ReferenceStorage) CheckAndSetReference(ref, old *plumbing.Reference) err
if old != nil {
tmp := r[ref.Name()]
if tmp != nil && tmp.Hash() != old.Hash() {
- return ErrRefHasChanged
+ return storage.ErrReferenceHasChanged
}
}
r[ref.Name()] = ref