summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-01-06 05:38:38 +0000
committerGitHub <noreply@github.com>2022-01-06 06:38:38 +0100
commit4b3bfd7e89cd1527d500ac44c2564d398a6b681e (patch)
tree6931e90da5cb4ee603812d029723b924f00a9f68 /modules
parent1514e13bb86d4714550107efa58c947b1bfc39c6 (diff)
downloadgitea-4b3bfd7e89cd1527d500ac44c2564d398a6b681e.tar.gz
gitea-4b3bfd7e89cd1527d500ac44c2564d398a6b681e.zip
Enable partial clone by default (#18195)
- Enable partial clones(which are by default disabled from git) by default, unless configured otherwise. - Resolves #18190
Diffstat (limited to 'modules')
-rw-r--r--modules/git/git.go5
-rw-r--r--modules/setting/git.go2
2 files changed, 7 insertions, 0 deletions
diff --git a/modules/git/git.go b/modules/git/git.go
index e6c34979e8..cca5ce6714 100644
--- a/modules/git/git.go
+++ b/modules/git/git.go
@@ -146,6 +146,11 @@ func Init(ctx context.Context) error {
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")
+ }
+
// Save current git version on init to gitVersion otherwise it would require an RWMutex
if err := LoadGitVersion(); err != nil {
return err
diff --git a/modules/setting/git.go b/modules/setting/git.go
index aaa65ed81c..4cf7e722e7 100644
--- a/modules/setting/git.go
+++ b/modules/setting/git.go
@@ -27,6 +27,7 @@ var (
PullRequestPushMessage bool
LargeObjectThreshold int64
DisableCoreProtectNTFS bool
+ DisablePartialClone bool
Timeout struct {
Default int
Migrate int
@@ -48,6 +49,7 @@ var (
EnableAutoGitWireProtocol: true,
PullRequestPushMessage: true,
LargeObjectThreshold: 1024 * 1024,
+ DisablePartialClone: false,
Timeout: struct {
Default int
Migrate int