diff --git a/common/lib/dependabot/git_commit_checker.rb b/common/lib/dependabot/git_commit_checker.rb index b13848140ab..3ccfbd21093 100644 --- a/common/lib/dependabot/git_commit_checker.rb +++ b/common/lib/dependabot/git_commit_checker.rb @@ -365,17 +365,19 @@ def listing_tag_for_version(version) def listing_tags return [] unless listing_source_url - tags = listing_repo_git_metadata_fetcher.tags + @listing_tags ||= begin + tags = listing_repo_git_metadata_fetcher.tags - if dependency_source_details&.fetch(:ref, nil)&.start_with?("tags/") - tags = tags.map do |tag| - tag.dup.tap { |t| t.name = "tags/#{tag.name}" } + if dependency_source_details&.fetch(:ref, nil)&.start_with?("tags/") + tags = tags.map do |tag| + tag.dup.tap { |t| t.name = "tags/#{tag.name}" } + end end - end - tags - rescue GitDependenciesNotReachable - [] + tags + rescue GitDependenciesNotReachable + [] + end end def listing_upload_pack