|
|
@ -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.
|
|
|
|
// NewContext initializes configuration context.
|
|
|
|
// NOTE: do not print any log except error.
|
|
|
|
// NOTE: do not print any log except error.
|
|
|
|
func NewContext() { |
|
|
|
func NewContext() { |
|
|
@ -888,7 +909,6 @@ func NewContext() { |
|
|
|
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute) |
|
|
|
LFS.HTTPAuthExpiry = sec.Key("LFS_HTTP_AUTH_EXPIRY").MustDuration(20 * time.Minute) |
|
|
|
|
|
|
|
|
|
|
|
if LFS.StartServer { |
|
|
|
if LFS.StartServer { |
|
|
|
|
|
|
|
|
|
|
|
if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil { |
|
|
|
if err := os.MkdirAll(LFS.ContentPath, 0700); err != nil { |
|
|
|
log.Fatal(4, "Failed to create '%s': %v", LFS.ContentPath, err) |
|
|
|
log.Fatal(4, "Failed to create '%s': %v", LFS.ContentPath, err) |
|
|
|
} |
|
|
|
} |
|
|
@ -922,26 +942,6 @@ func NewContext() { |
|
|
|
return |
|
|
|
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") |
|
|
|
sec = Cfg.Section("security") |
|
|
|