diff options
Diffstat (limited to 'cmd/serv.go')
-rw-r--r-- | cmd/serv.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index c98228745d..ec2258412f 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -14,6 +14,7 @@ import ( "strings" "time" + "code.gitea.io/git" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/pprof" @@ -22,6 +23,7 @@ import ( "github.com/Unknwon/com" "github.com/dgrijalva/jwt-go" + version "github.com/mcuadros/go-version" "github.com/urfave/cli" ) @@ -48,8 +50,28 @@ var CmdServ = cli.Command{ }, } +func checkLFSVersion() { + if setting.LFS.StartServer { + //Disable LFS client hooks if installed for the current OS user + //Needs at least git v2.1.2 + binVersion, err := git.BinVersion() + if err != nil { + fail(fmt.Sprintf("Error retrieving git version: %v", err), fmt.Sprintf("Error retrieving git version: %v", err)) + } + + if !version.Compare(binVersion, "2.1.2", ">=") { + setting.LFS.StartServer = false + println("LFS server support needs at least Git v2.1.2, disabled") + } else { + git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "filter.lfs.required=", + "-c", "filter.lfs.smudge=", "-c", "filter.lfs.clean=") + } + } +} + func setup(logPath string) { setting.NewContext() + checkLFSVersion() log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath)) } |