diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-12-15 13:45:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-15 13:45:52 +0100 |
commit | 249c4137f4f34992c9bb6a60954e30a27994add7 (patch) | |
tree | 1188a410d368c619548d74798c474e04469eabae /storage/memory/storage.go | |
parent | f01fd176ff61a3f37d096939690aa103de054ecc (diff) | |
download | go-git-249c4137f4f34992c9bb6a60954e30a27994add7.tar.gz |
storage: shallow storage (#180)
* storage: shallow storage
* changes
* changes
Diffstat (limited to 'storage/memory/storage.go')
-rw-r--r-- | storage/memory/storage.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go index a912e94..ecf2efa 100644 --- a/storage/memory/storage.go +++ b/storage/memory/storage.go @@ -18,6 +18,7 @@ var ErrUnsupportedObjectType = fmt.Errorf("unsupported object type") type Storage struct { ConfigStorage ObjectStorage + ShallowStorage ReferenceStorage } @@ -26,6 +27,7 @@ func NewStorage() *Storage { return &Storage{ ReferenceStorage: make(ReferenceStorage, 0), ConfigStorage: ConfigStorage{}, + ShallowStorage: ShallowStorage{}, ObjectStorage: ObjectStorage{ Objects: make(map[plumbing.Hash]plumbing.EncodedObject, 0), Commits: make(map[plumbing.Hash]plumbing.EncodedObject, 0), @@ -195,3 +197,14 @@ func (r ReferenceStorage) IterReferences() (storer.ReferenceIter, error) { return storer.NewReferenceSliceIter(refs), nil } + +type ShallowStorage []plumbing.Hash + +func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error { + *s = commits + return nil +} + +func (s ShallowStorage) Shallow() ([]plumbing.Hash, error) { + return s, nil +} |