From 7c83cbb6e54c96c474a0d46cc102715e0380419c Mon Sep 17 00:00:00 2001 From: Ameir Abdeldayem Date: Fri, 15 Jan 2021 18:11:35 -0500 Subject: [PATCH] When tags are excluded, do not include those tags in diff links. --- .../generator/generator_tags.rb | 8 +------- spec/unit/generator/generator_tags_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index e5959b4eb..2a1e17039 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -13,13 +13,7 @@ def fetch_and_filter_tags @sorted_tags = filter_excluded_tags(all_sorted_tags) @filtered_tags = get_filtered_tags(@sorted_tags) - - # Because we need to properly create compare links, we need a sorted list - # of all filtered tags (including the excluded ones). We'll exclude those - # tags from section headers inside the mapping function. - section_tags = get_filtered_tags(all_sorted_tags) - - @tag_section_mapping = build_tag_section_mapping(section_tags, @filtered_tags) + @tag_section_mapping = build_tag_section_mapping(@filtered_tags, @filtered_tags) @filtered_tags end diff --git a/spec/unit/generator/generator_tags_spec.rb b/spec/unit/generator/generator_tags_spec.rb index cd6da3e86..32755d4f1 100644 --- a/spec/unit/generator/generator_tags_spec.rb +++ b/spec/unit/generator/generator_tags_spec.rb @@ -84,10 +84,10 @@ def tags_from_strings(tags_strings) shared_examples_for "a changelog with some exclusions" do let(:expected_mapping) do { - tag_with_name("8") => [tag_with_name("7"), tag_with_name("8")], - tag_with_name("6") => [tag_with_name("5"), tag_with_name("6")], + tag_with_name("8") => [tag_with_name("6"), tag_with_name("8")], + tag_with_name("6") => [tag_with_name("4"), tag_with_name("6")], tag_with_name("4") => [tag_with_name("3"), tag_with_name("4")], - tag_with_name("3") => [tag_with_name("2"), tag_with_name("3")], + tag_with_name("3") => [tag_with_name("1"), tag_with_name("3")], tag_with_name("1") => [nil, tag_with_name("1")] } end