Only use SHA256 feature when git >= 2.42 (#28466)

And fix some comments
This commit is contained in:
wxiaoguang 2023-12-14 16:51:05 +08:00 committed by GitHub
parent 52046b934d
commit 9947af639c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 12 deletions

View file

@ -33,8 +33,8 @@ var (
// DefaultContext is the default context to run git commands in, must be initialized by git.InitXxx
DefaultContext context.Context
// SupportProcReceive version >= 2.29.0
SupportProcReceive bool
SupportProcReceive bool // >= 2.29
SupportHashSha256 bool // >= 2.42, SHA-256 repositories no longer an experimental curiosity
gitVersion *version.Version
)
@ -189,7 +189,7 @@ func InitFull(ctx context.Context) (err error) {
globalCommandArgs = append(globalCommandArgs, "-c", "credential.helper=")
}
SupportProcReceive = CheckGitVersionAtLeast("2.29") == nil
SupportHashSha256 = CheckGitVersionAtLeast("2.42") == nil
if setting.LFS.StartServer {
if CheckGitVersionAtLeast("2.1.2") != nil {
return errors.New("LFS server support requires Git >= 2.1.2")