MCPcopy
hub / github.com/git-lfs/git-lfs / gitConfigNoLFS

Function gitConfigNoLFS

git/git.go:181–200  ·  view source on GitHub ↗

Prepend Git config instructions to disable Git LFS filter

(args ...string)

Source from the content-addressed store, hash-verified

179
180// Prepend Git config instructions to disable Git LFS filter
181func gitConfigNoLFS(args ...string) []string {
182 // Before git 2.8, setting filters to blank causes lots of warnings, so use cat instead (slightly slower)
183 // Also pre 2.2 it failed completely. We used to use it anyway in git 2.2-2.7 and
184 // suppress the messages in stderr, but doing that with standard StderrPipe suppresses
185 // the git clone output (git thinks it's not a terminal) and makes it look like it's
186 // not working. You can get around that with https://github.com/kr/pty but that
187 // causes difficult issues with passing through Stdin for login prompts
188 // This way is simpler & more practical.
189 filterOverride := ""
190 if !IsGitVersionAtLeast("2.8.0") {
191 filterOverride = "cat"
192 }
193
194 return append([]string{
195 "-c", fmt.Sprintf("filter.lfs.smudge=%v", filterOverride),
196 "-c", fmt.Sprintf("filter.lfs.clean=%v", filterOverride),
197 "-c", "filter.lfs.process=",
198 "-c", "filter.lfs.required=false",
199 }, args...)
200}
201
202// Invoke Git with disabled LFS filters
203func gitNoLFS(args ...string) (*subprocess.Cmd, error) {

Callers 4

gitNoLFSFunction · 0.85
gitNoLFSSimpleFunction · 0.85
gitNoLFSBufferedFunction · 0.85
gitNoLFSBufferedStdoutFunction · 0.85

Calls 1

IsGitVersionAtLeastFunction · 0.85

Tested by

no test coverage detected