diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index a7476ad1be..606b8a864e 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -1886,9 +1886,6 @@ LEVEL = Info ;; Time to keep items in cache if not used, default is 8760 hours. ;; Setting it to -1 disables caching ;ITEM_TTL = 8760h -;; -;; Only enable the cache when repository's commits count great than -;COMMITS_COUNT = 1000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/modules/git/repo_base_gogit.go b/modules/git/repo_base_gogit.go index 115d176308..cb04a0bc34 100644 --- a/modules/git/repo_base_gogit.go +++ b/modules/git/repo_base_gogit.go @@ -81,7 +81,7 @@ func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) { return nil, err } - return &Repository{ + repo := &Repository{ Path: repoPath, gogitRepo: gogitRepo, gogitStorage: storage, @@ -89,7 +89,10 @@ func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) { commitCache: make(map[string]*Commit), Ctx: ctx, objectFormat: ParseGogitHash(plumbing.ZeroHash).Type(), - }, nil + } + repo.lastCommitCache = newLastCommitCache(repo.Path, repo, cache.GetCache()) + + return repo, nil } // Close this repository, in particular close the underlying gogitStorage if this is not nil