2017-10-24 17:42:00 +00:00
|
|
|
package lfs
|
|
|
|
|
|
|
|
import (
|
2021-08-10 06:18:38 +00:00
|
|
|
"github.com/git-lfs/git-lfs/v2/config"
|
|
|
|
"github.com/git-lfs/git-lfs/v2/fs"
|
|
|
|
"github.com/git-lfs/git-lfs/v2/git"
|
2017-10-24 17:42:00 +00:00
|
|
|
)
|
|
|
|
|
2017-10-24 19:54:09 +00:00
|
|
|
// GitFilter provides clean and smudge capabilities
|
2017-10-24 17:42:00 +00:00
|
|
|
type GitFilter struct {
|
|
|
|
cfg *config.Configuration
|
2017-10-25 17:31:15 +00:00
|
|
|
fs *fs.Filesystem
|
2017-10-24 17:42:00 +00:00
|
|
|
}
|
|
|
|
|
2017-10-24 19:54:09 +00:00
|
|
|
// NewGitFilter initializes a new *GitFilter
|
2017-10-24 17:42:00 +00:00
|
|
|
func NewGitFilter(cfg *config.Configuration) *GitFilter {
|
2017-10-25 17:31:15 +00:00
|
|
|
return &GitFilter{cfg: cfg, fs: cfg.Filesystem()}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *GitFilter) ObjectPath(oid string) (string, error) {
|
|
|
|
return f.fs.ObjectPath(oid)
|
2017-10-24 17:42:00 +00:00
|
|
|
}
|
2018-01-05 22:01:29 +00:00
|
|
|
|
|
|
|
func (f *GitFilter) RemoteRef() *git.Ref {
|
|
|
|
return git.NewRefUpdate(f.cfg.Git, f.cfg.PushRemote(), f.cfg.CurrentRef(), nil).Right()
|
|
|
|
}
|