summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-04-04 14:25:15 +0000
committerDouwe Maan <douwe@gitlab.com>2016-04-04 14:25:15 +0000
commitba7fcc9866588eb215fc69f5d8b73c77805e4eef (patch)
tree282f0a18f0b568c843213f8c1ca7711c852af055 /app/models
parentdf77df46f5df41b53eff4906a19b8523a007671b (diff)
parente6b5716785a31396c2aa8b044a087e8b2ca5fac3 (diff)
downloadgitlab-ce-ba7fcc9866588eb215fc69f5d8b73c77805e4eef.tar.gz
Merge branch 'update_repository_from_ee' into 'master'
Migrate Repository#local_branches from gitlab-ee. REF: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/249 This will help us to avoid posible merge conflicts when merging gitlab-ce to gitlab-ee See merge request !3496
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index bf76de61148..e80c2238402 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -72,7 +72,7 @@ class Repository
return @has_visible_content unless @has_visible_content.nil?
@has_visible_content = cache.fetch(:has_visible_content?) do
- raw_repository.branch_count > 0
+ branch_count > 0
end
end
@@ -173,7 +173,7 @@ class Repository
end
def branch_names
- cache.fetch(:branch_names) { raw_repository.branch_names }
+ cache.fetch(:branch_names) { branches.map(&:name) }
end
def tag_names
@@ -191,7 +191,7 @@ class Repository
end
def branch_count
- @branch_count ||= cache.fetch(:branch_count) { raw_repository.branch_count }
+ @branch_count ||= cache.fetch(:branch_count) { branches.size }
end
def tag_count
@@ -239,7 +239,7 @@ class Repository
def expire_branches_cache
cache.expire(:branch_names)
- @branches = nil
+ @local_branches = nil
end
def expire_cache(branch_name = nil, revision = nil)
@@ -614,10 +614,14 @@ class Repository
refs_contains_sha('tag', sha)
end
- def branches
- @branches ||= raw_repository.branches
+ def local_branches
+ @local_branches ||= rugged.branches.each(:local).map do |branch|
+ Gitlab::Git::Branch.new(branch.name, branch.target)
+ end
end
+ alias_method :branches, :local_branches
+
def tags
@tags ||= raw_repository.tags
end