diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-02-02 10:14:24 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2019-02-02 10:14:24 +0100 |
commit | 96317743391ac87aeb07d292469e212671628437 (patch) | |
tree | 990bbe4a11241f2ac3a5f4a71d514884b9c2b962 /storage/transactional/shallow.go | |
parent | 12dc3ef13e5c783b9e304aa8b6a2f7097880ab87 (diff) | |
download | go-git-96317743391ac87aeb07d292469e212671628437.tar.gz |
storage: transactional, package documentation
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'storage/transactional/shallow.go')
-rw-r--r-- | storage/transactional/shallow.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/storage/transactional/shallow.go b/storage/transactional/shallow.go index 07663d4..bedc325 100644 --- a/storage/transactional/shallow.go +++ b/storage/transactional/shallow.go @@ -5,22 +5,27 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing/storer" ) +// ShallowStorage implements the storer.ShallowStorer for the transactional package. type ShallowStorage struct { storer.ShallowStorer temporal storer.ShallowStorer } -func NewShallowStorage(s, temporal storer.ShallowStorer) *ShallowStorage { +// NewShallowStorage returns a new ShallowStorage based on a base storer and +// a temporal storer. +func NewShallowStorage(base, temporal storer.ShallowStorer) *ShallowStorage { return &ShallowStorage{ - ShallowStorer: s, + ShallowStorer: base, temporal: temporal, } } +// SetShallow honors the storer.ShallowStorer interface. func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error { return s.temporal.SetShallow(commits) } +// Shallow honors the storer.ShallowStorer interface. func (s *ShallowStorage) Shallow() ([]plumbing.Hash, error) { shallow, err := s.temporal.Shallow() if err != nil { @@ -34,6 +39,8 @@ func (s *ShallowStorage) Shallow() ([]plumbing.Hash, error) { return s.ShallowStorer.Shallow() } +// Commit it copies the shallow information of the temporal storage into the +// base storage. func (s *ShallowStorage) Commit() error { commits, err := s.temporal.Shallow() if err != nil || len(commits) == 0 { |