summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-09-14 10:48:12 +0200
committerJarka Kadlecova <jarka@gitlab.com>2017-09-14 13:03:36 +0200
commit0657002251a48e39849204b6eed8e633bee32563 (patch)
treefafa0121328dcec6bfdc7a59c23dda812dc94fde /app
parent1140fcce4f8b5463f451356b76fea125826478b2 (diff)
downloadgitlab-ce-0657002251a48e39849204b6eed8e633bee32563.tar.gz
Restore has_visible_content? to improve performance (cache)repo-cache-fix
This method was moved to ::Git but it is not cached there which causes performance problems
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 035f85a0b46..6ed33e0c268 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -90,6 +90,12 @@ class Repository
)
end
+ # we need to have this method here because it is not cached in ::Git and
+ # the method is called multiple times for every request
+ def has_visible_content?
+ branch_count > 0
+ end
+
def inspect
"#<#{self.class.name}:#{@disk_path}>"
end