fix lfs version check warning log when using ssh protocol (#5501)
This commit is contained in:
parent
2a660a1de1
commit
7fd34c0517
5 changed files with 48 additions and 30 deletions
|
@ -693,6 +693,27 @@ func createPIDFile(pidPath string) {
|
|||
}
|
||||
}
|
||||
|
||||
// CheckLFSVersion will check lfs version, if not satisfied, then disable it.
|
||||
func CheckLFSVersion() {
|
||||
if 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 {
|
||||
log.Fatal(4, "Error retrieving git version: %v", err)
|
||||
}
|
||||
|
||||
if !version.Compare(binVersion, "2.1.2", ">=") {
|
||||
LFS.StartServer = false
|
||||
log.Error(4, "LFS server support needs at least Git v2.1.2")
|
||||
} else {
|
||||
git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "filter.lfs.required=",
|
||||
"-c", "filter.lfs.smudge=", "-c", "filter.lfs.clean=")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewContext initializes configuration context.
|
||||
// NOTE: do not print any log except error.
|
||||
func NewContext() {
|
||||
|
@ -888,7 +909,6 @@ func NewContext() {
|
|||
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute)
|
||||
|
||||
if LFS.StartServer {
|
||||
|
||||
if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil {
|
||||
log.Fatal(4, "Failed to create '%s': %v", LFS.ContentPath, err)
|
||||
}
|
||||
|
@ -922,26 +942,6 @@ func NewContext() {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
//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 {
|
||||
log.Fatal(4, "Error retrieving git version: %v", err)
|
||||
}
|
||||
|
||||
if !version.Compare(binVersion, "2.1.2", ">=") {
|
||||
|
||||
LFS.StartServer = false
|
||||
log.Error(4, "LFS server support needs at least Git v2.1.2")
|
||||
|
||||
} else {
|
||||
|
||||
git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "filter.lfs.required=",
|
||||
"-c", "filter.lfs.smudge=", "-c", "filter.lfs.clean=")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sec = Cfg.Section("security")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue