aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
authorJeremy Stribling <strib@alum.mit.edu>2017-11-28 11:14:09 -0800
committerJeremy Stribling <strib@alum.mit.edu>2017-11-28 11:23:52 -0800
commitcbab840ef28888c2e85112b3b48294f7333ec187 (patch)
tree9fbd8da724791193905635a4ed789c6ddf8f39c5 /plumbing
parent83e7046d0c1ce12f5394a1d5a4e28cad32aa666d (diff)
downloadgo-git-cbab840ef28888c2e85112b3b48294f7333ec187.tar.gz
dotgit: add CheckAndSetReference tests
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/storer/reference.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/plumbing/storer/reference.go b/plumbing/storer/reference.go
index 50e5886..ae80a39 100644
--- a/plumbing/storer/reference.go
+++ b/plumbing/storer/reference.go
@@ -16,6 +16,10 @@ var ErrMaxResolveRecursion = errors.New("max. recursion level reached")
// ReferenceStorer is a generic storage of references.
type ReferenceStorer interface {
SetReference(*plumbing.Reference) error
+ // CheckAndSetReference sets the reference `new`, but if `old` is
+ // not `nil`, it first checks that the current stored value for
+ // `old.Name()` matches the given reference value in `old`. If
+ // not, it returns an error and doesn't update `new`.
CheckAndSetReference(new, old *plumbing.Reference) error
Reference(plumbing.ReferenceName) (*plumbing.Reference, error)
IterReferences() (ReferenceIter, error)