From abf9c65f2bda696d27c39b22568a39d9ca7fc934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 12 Nov 2020 16:37:29 +0100 Subject: [PATCH] Make changelog generation idempotent So that running `rake generate_changelog` with a target unreleased version that already exists in the CHANGELOG overwrites that section. --- util/changelog.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/changelog.rb b/util/changelog.rb index a060b8edf27e..2eaebdab469c 100644 --- a/util/changelog.rb +++ b/util/changelog.rb @@ -83,7 +83,7 @@ def cut! format_header, "", unreleased_notes, - lines, + released_notes, ].join("\n") + "\n" File.write(@file, full_new_changelog) @@ -227,7 +227,7 @@ def relevant_pull_requests_for(ids) end def released_notes - lines.drop_while {|line| !line.start_with?(release_section_token) } + lines.drop_while {|line| !line.start_with?(release_section_token) || !line.include?(@latest_release.tag_name.gsub(/^.*-v/, "")) } end def lines