Skip to content

Commit a785c46

Browse files
6543zeripath
andauthored
Add uploadpack.allowAnySHA1InWant to allow --filter=blob:none with older git clients (#19430) (#19438)
Older git clients need uploadpack.allowAnySHA1InWant if partial cloning is allowed. Fix #19118 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent 6bddfd3 commit a785c46

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/git/git.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func SetExecutablePath(path string) error {
112112

113113
// VersionInfo returns git version information
114114
func VersionInfo() string {
115-
var format = "Git Version: %s"
116-
var args = []interface{}{gitVersion.Original()}
115+
format := "Git Version: %s"
116+
args := []interface{}{gitVersion.Original()}
117117
// Since git wire protocol has been released from git v2.18
118118
if setting.Git.EnableAutoGitWireProtocol && CheckGitVersionAtLeast("2.18") == nil {
119119
format += ", Wire Protocol %s Enabled"
@@ -148,7 +148,7 @@ func Init(ctx context.Context) error {
148148

149149
// By default partial clones are disabled, enable them from git v2.22
150150
if !setting.Git.DisablePartialClone && CheckGitVersionAtLeast("2.22") == nil {
151-
GlobalCommandArgs = append(GlobalCommandArgs, "-c", "uploadpack.allowfilter=true")
151+
GlobalCommandArgs = append(GlobalCommandArgs, "-c", "uploadpack.allowfilter=true", "-c", "uploadpack.allowAnySHA1InWant=true")
152152
}
153153

154154
// Save current git version on init to gitVersion otherwise it would require an RWMutex

0 commit comments

Comments
 (0)