summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-06-30 21:58:45 +0100
committerGitHub <noreply@github.com>2021-06-30 22:58:45 +0200
commit99799832835aae6a8641112cb71eb87baef32afa (patch)
treea9dd27526f1431f8c7e317a32cb9eae19c8dc993 /modules
parent4f26e0ac0ea32968e94403e16cb776e7a4e5e690 (diff)
downloadgitea-99799832835aae6a8641112cb71eb87baef32afa.tar.gz
gitea-99799832835aae6a8641112cb71eb87baef32afa.zip
Update Go-Git to take advantage of LargeObjectThreshold (#16316)
Following the merging of https://github.com/go-git/go-git/pull/330 we can now add a setting to avoid go-git reading and caching large objects. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/git/repo_base_gogit.go4
-rw-r--r--modules/setting/git.go2
2 files changed, 5 insertions, 1 deletions
diff --git a/modules/git/repo_base_gogit.go b/modules/git/repo_base_gogit.go
index 19a3f84571..6186824c0b 100644
--- a/modules/git/repo_base_gogit.go
+++ b/modules/git/repo_base_gogit.go
@@ -12,6 +12,8 @@ import (
"path/filepath"
gitealog "code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/setting"
+
"github.com/go-git/go-billy/v5/osfs"
gogit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/cache"
@@ -46,7 +48,7 @@ func OpenRepository(repoPath string) (*Repository, error) {
return nil, err
}
}
- storage := filesystem.NewStorageWithOptions(fs, cache.NewObjectLRUDefault(), filesystem.Options{KeepDescriptors: true})
+ storage := filesystem.NewStorageWithOptions(fs, cache.NewObjectLRUDefault(), filesystem.Options{KeepDescriptors: true, LargeObjectThreshold: setting.Git.LargeObjectThreshold})
gogitRepo, err := gogit.Open(storage, fs)
if err != nil {
return nil, err
diff --git a/modules/setting/git.go b/modules/setting/git.go
index 7383996cb9..aa838a8d64 100644
--- a/modules/setting/git.go
+++ b/modules/setting/git.go
@@ -25,6 +25,7 @@ var (
GCArgs []string `ini:"GC_ARGS" delim:" "`
EnableAutoGitWireProtocol bool
PullRequestPushMessage bool
+ LargeObjectThreshold int64
Timeout struct {
Default int
Migrate int
@@ -45,6 +46,7 @@ var (
GCArgs: []string{},
EnableAutoGitWireProtocol: true,
PullRequestPushMessage: true,
+ LargeObjectThreshold: 1024 * 1024,
Timeout: struct {
Default int
Migrate int