github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/git/lfs.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 package git 7 8 import ( 9 "sync" 10 11 logger "github.com/gitbundle/modules/log" 12 "github.com/gitbundle/modules/setting" 13 ) 14 15 var once sync.Once 16 17 // CheckLFSVersion will check lfs version, if not satisfied, then disable it. 18 func CheckLFSVersion() { 19 if setting.LFS.StartServer { 20 // Disable LFS client hooks if installed for the current OS user 21 // Needs at least git v2.1.2 22 if CheckGitVersionAtLeast("2.1.2") != nil { 23 setting.LFS.StartServer = false 24 logger.Error("LFS server support needs at least Git v2.1.2") 25 } else { 26 once.Do(func() { 27 globalCommandArgs = append(globalCommandArgs, "-c", "filter.lfs.required=", 28 "-c", "filter.lfs.smudge=", "-c", "filter.lfs.clean=") 29 }) 30 } 31 } 32 }