2017-10-24 17:42:00 +00:00
|
|
|
package lfs
|
|
|
|
|
|
|
|
import (
|
2021-09-01 19:41:10 +00:00
|
|
|
"github.com/git-lfs/git-lfs/v3/config"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/fs"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/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 {
|
commands,git,lfs: rename left/right RefUpdate vars
Since at least PR #2706, and indeed earlier, the local and remote
refs which are part of the RefUpdate structure have been referred
to as the "left" and "right" refs, terminology which stems from
the origin of this structure in the "git lfs pre-push" hook command,
where each line of input contains commit information in the form:
<local ref> <local sha1> <remote ref> <remote sha1>
However, outside of this context, "left" and "right" are ambiguous
terms, and may potentially be confused with the left and right
refs specified in a Git-style two-dot range notation. We therefore
replace these terms with "local" and "remote", which should help
clarify their purpose throughout the codebase.
2022-02-07 03:09:53 +00:00
|
|
|
return git.NewRefUpdate(f.cfg.Git, f.cfg.PushRemote(), f.cfg.CurrentRef(), nil).RemoteRef()
|
2018-01-05 22:01:29 +00:00
|
|
|
}
|