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