git-lfs/lfs/gitfilter.go
Chris Darroch dd8e306e31 all: update go.mod module path with explicit v2
When our go.mod file was introduced in commit
114e85c2002091eb415040923d872f8e4a4bc636 in PR #3208, the module
path chosen did not include a trailing /v2 component.  However,
the Go modules specification now advises that module paths must
have a "major version suffix" which matches the release version.

We therefore add a /v2 suffix to our module path and all its
instances in import paths.

See also https://golang.org/ref/mod#major-version-suffixes for
details regarding the Go module system's major version suffix rule.
2021-08-09 23:18:38 -07:00

27 lines
648 B
Go

package lfs
import (
"github.com/git-lfs/git-lfs/v2/config"
"github.com/git-lfs/git-lfs/v2/fs"
"github.com/git-lfs/git-lfs/v2/git"
)
// GitFilter provides clean and smudge capabilities
type GitFilter struct {
cfg *config.Configuration
fs *fs.Filesystem
}
// NewGitFilter initializes a new *GitFilter
func NewGitFilter(cfg *config.Configuration) *GitFilter {
return &GitFilter{cfg: cfg, fs: cfg.Filesystem()}
}
func (f *GitFilter) ObjectPath(oid string) (string, error) {
return f.fs.ObjectPath(oid)
}
func (f *GitFilter) RemoteRef() *git.Ref {
return git.NewRefUpdate(f.cfg.Git, f.cfg.PushRemote(), f.cfg.CurrentRef(), nil).Right()
}