Commit 86473393 authored by Rubén Dávila's avatar Rubén Dávila

Make sure we use only local branches for listing.

* Also added small fix for the scenario when the remote repo is empty
 and does not have tags.
parent 27899f84
......@@ -77,7 +77,7 @@ class Repository
return @has_visible_content unless @has_visible_content.nil?
@has_visible_content = cache.fetch(:has_visible_content?) do
branch_count > 0
local_branches.size > 0
end
end
......@@ -133,7 +133,7 @@ class Repository
end
def find_branch(name)
raw_repository.branches.find { |branch| branch.name == name }
branches.find { |branch| branch.name == name }
end
def find_tag(name)
......@@ -248,7 +248,7 @@ class Repository
end
def branch_count
@branch_count ||= cache.fetch(:branch_count) { branches.size }
@branch_count ||= cache.fetch(:branch_count) { local_branches.size }
end
def tag_count
......
......@@ -50,8 +50,11 @@ module Gitlab
# We want to convert it to: [{ 'v1.10.0' => 'dc872e9fa6963f8f03da6c8f6f264d0845d6b092' }, ...]
tags_with_targets = output.lines.flat_map do |line|
target, path = line.strip!.split("\t")
name = path.split('/', 3).last
# When the remote repo is empty we don't have tags.
break if target.nil?
name = path.split('/', 3).last
[name, target]
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment