Method
CheckAndSetReference
(ref, old *plumbing.Reference)
Source from the content-addressed store, hash-verified
| 254 | } |
| 255 | |
| 256 | func (r ReferenceStorage) CheckAndSetReference(ref, old *plumbing.Reference) error { |
| 257 | if ref == nil { |
| 258 | return nil |
| 259 | } |
| 260 | |
| 261 | if old != nil { |
| 262 | tmp := r[ref.Name()] |
| 263 | if tmp != nil && tmp.Hash() != old.Hash() { |
| 264 | return storage.ErrReferenceHasChanged |
| 265 | } |
| 266 | } |
| 267 | r[ref.Name()] = ref |
| 268 | return nil |
| 269 | } |
| 270 | |
| 271 | func (r ReferenceStorage) Reference(n plumbing.ReferenceName) (*plumbing.Reference, error) { |
| 272 | ref, ok := r[n] |
Callers
nothing calls this directly
Tested by
no test coverage detected