Commit 8ca55c37 authored by Sean McGivern's avatar Sean McGivern

Cache Repository#has_ambiguous_refs? properly

parent b66f1d0d
...@@ -220,6 +220,7 @@ class Repository ...@@ -220,6 +220,7 @@ class Repository
prefix_regex.match?(ref) prefix_regex.match?(ref)
end end
end end
cache_method :has_ambiguous_refs?
def expand_ref(ref) def expand_ref(ref)
if tag_exists?(ref) if tag_exists?(ref)
...@@ -311,12 +312,12 @@ class Repository ...@@ -311,12 +312,12 @@ class Repository
end end
def expire_tags_cache def expire_tags_cache
expire_method_caches(%i(tag_names tag_count)) expire_method_caches(%i(tag_names tag_count has_ambiguous_refs?))
@tags = nil @tags = nil
end end
def expire_branches_cache def expire_branches_cache
expire_method_caches(%i(branch_names merged_branch_names branch_count has_visible_content?)) expire_method_caches(%i(branch_names merged_branch_names branch_count has_visible_content? has_ambiguous_refs?))
@local_branches = nil @local_branches = nil
@branch_exists_memo = nil @branch_exists_memo = nil
end end
......
...@@ -2103,7 +2103,7 @@ RSpec.describe Repository do ...@@ -2103,7 +2103,7 @@ RSpec.describe Repository do
describe '#expire_branches_cache' do describe '#expire_branches_cache' do
it 'expires the cache' do it 'expires the cache' do
expect(repository).to receive(:expire_method_caches) expect(repository).to receive(:expire_method_caches)
.with(%i(branch_names merged_branch_names branch_count has_visible_content?)) .with(%i(branch_names merged_branch_names branch_count has_visible_content? has_ambiguous_refs?))
.and_call_original .and_call_original
repository.expire_branches_cache repository.expire_branches_cache
...@@ -2113,7 +2113,7 @@ RSpec.describe Repository do ...@@ -2113,7 +2113,7 @@ RSpec.describe Repository do
describe '#expire_tags_cache' do describe '#expire_tags_cache' do
it 'expires the cache' do it 'expires the cache' do
expect(repository).to receive(:expire_method_caches) expect(repository).to receive(:expire_method_caches)
.with(%i(tag_names tag_count)) .with(%i(tag_names tag_count has_ambiguous_refs?))
.and_call_original .and_call_original
repository.expire_tags_cache repository.expire_tags_cache
......
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