mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Unexport git.GlobalCommandArgs (#18376)
Unexport the git.GlobalCommandArgs variable.
This commit is contained in:
		@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user