aboutsummaryrefslogblamecommitdiffstats
path: root/storage/filesystem/reference.go
blob: b2aa6d983bb22069aaf4440d78d935c1441f1c37 (plain) (tree)
1
2
3
4
5
6
7
8
9


                  




                                                                     
                          


                                                           
                                


                                                                               
                           


                                                               

                                 
                               

         
                                                    
 
package filesystem

import (
	"gopkg.in/src-d/go-git.v4/core"
	"gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit"
)

type ReferenceStorage struct {
	dir *dotgit.DotGit
}

func (r *ReferenceStorage) Set(ref *core.Reference) error {
	return r.dir.SetRef(ref)
}

func (r *ReferenceStorage) Get(n core.ReferenceName) (*core.Reference, error) {
	return r.dir.Ref(n)
}

func (r *ReferenceStorage) Iter() (core.ReferenceIter, error) {
	refs, err := r.dir.Refs()
	if err != nil {
		return nil, err
	}

	return core.NewReferenceSliceIter(refs), nil
}