diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index e060cde4..1221eb69 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -386,9 +386,15 @@ def commits_in_tag(sha, shas = Set.new) queue = [current] while queue.any? commit = queue.shift - # If we've already processed this sha, just grab it's parents from the cache if @commits_in_tag_cache.key?(commit[:sha]) + # If we've already processed this sha in a previous run, just grab + # its parents from the cache shas.merge(@commits_in_tag_cache[commit[:sha]]) + elsif shas.include?(commit[:sha]) + # If we've already processed this sha in the current run, stop there + # for the current commit because its parents have already been + # queued/processed. Jump to the next queued commit. + next else shas.add(commit[:sha]) commit[:parents].each do |p|