Unexport git.GlobalCommandArgs (#18376)

Unexport the git.GlobalCommandArgs variable.
This commit is contained in:
6543 2022-01-25 19:15:58 +01:00 committed by GitHub
parent 93250bfe27
commit 80adbebbc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 39 deletions

View file

@ -134,21 +134,21 @@ func Init(ctx context.Context) error {
}
// force cleanup args
GlobalCommandArgs = []string{}
globalCommandArgs = []string{}
if CheckGitVersionAtLeast("2.9") == nil {
// Explicitly disable credential helper, otherwise Git credentials might leak
GlobalCommandArgs = append(GlobalCommandArgs, "-c", "credential.helper=")
globalCommandArgs = append(globalCommandArgs, "-c", "credential.helper=")
}
// Since git wire protocol has been released from git v2.18
if setting.Git.EnableAutoGitWireProtocol && CheckGitVersionAtLeast("2.18") == nil {
GlobalCommandArgs = append(GlobalCommandArgs, "-c", "protocol.version=2")
globalCommandArgs = append(globalCommandArgs, "-c", "protocol.version=2")
}
// By default partial clones are disabled, enable them from git v2.22
if !setting.Git.DisablePartialClone && CheckGitVersionAtLeast("2.22") == nil {
GlobalCommandArgs = append(GlobalCommandArgs, "-c", "uploadpack.allowfilter=true")
globalCommandArgs = append(globalCommandArgs, "-c", "uploadpack.allowfilter=true")
}
// Save current git version on init to gitVersion otherwise it would require an RWMutex
@ -213,7 +213,7 @@ func Init(ctx context.Context) error {
if err := checkAndSetConfig("core.protectntfs", "false", true); err != nil {
return err
}
GlobalCommandArgs = append(GlobalCommandArgs, "-c", "core.protectntfs=false")
globalCommandArgs = append(globalCommandArgs, "-c", "core.protectntfs=false")
}
return nil
}