github.com/git-lfs/git-lfs@v2.5.2+incompatible/lfs/gitfilter.go (about)

     1  package lfs
     2  
     3  import (
     4  	"github.com/git-lfs/git-lfs/config"
     5  	"github.com/git-lfs/git-lfs/fs"
     6  	"github.com/git-lfs/git-lfs/git"
     7  )
     8  
     9  // GitFilter provides clean and smudge capabilities
    10  type GitFilter struct {
    11  	cfg *config.Configuration
    12  	fs  *fs.Filesystem
    13  }
    14  
    15  // NewGitFilter initializes a new *GitFilter
    16  func NewGitFilter(cfg *config.Configuration) *GitFilter {
    17  	return &GitFilter{cfg: cfg, fs: cfg.Filesystem()}
    18  }
    19  
    20  func (f *GitFilter) ObjectPath(oid string) (string, error) {
    21  	return f.fs.ObjectPath(oid)
    22  }
    23  
    24  func (f *GitFilter) RemoteRef() *git.Ref {
    25  	return git.NewRefUpdate(f.cfg.Git, f.cfg.PushRemote(), f.cfg.CurrentRef(), nil).Right()
    26  }