summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-20 15:38:54 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-20 21:44:21 +0200
commit208b18c956b38103b98bc93a952dc1e8a200dead (patch)
tree518e0892089d6d3771097192be2487c446343bfa /app/models/repository.rb
parent74f8f260982a9b9e1941ad803d53d229cc27c85f (diff)
downloadgitlab-ce-208b18c956b38103b98bc93a952dc1e8a200dead.tar.gz
Unify check branch name exist
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index bbd7682d8e7..e9de6418fe0 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -192,7 +192,7 @@ class Repository
end
def branch_names
- cache.fetch(:branch_names) { branches.map(&:name) }
+ @branch_names ||= cache.fetch(:branch_names) { branches.map(&:name) }
end
def branch_exists?(branch_name)
@@ -267,6 +267,7 @@ class Repository
def expire_branches_cache
cache.expire(:branch_names)
+ @branch_names = nil
@local_branches = nil
end
@@ -332,10 +333,6 @@ class Repository
@lookup_cache ||= {}
end
- def expire_branch_names
- cache.expire(:branch_names)
- end
-
def expire_avatar_cache(branch_name = nil, revision = nil)
# Avatars are pulled from the default branch, thus if somebody pushes to a
# different branch there's no need to expire anything.