From a97f914e5be7c10f44c7573ac41b1c4f0377136d Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Mon, 16 Oct 2017 16:20:20 +0200 Subject: Ensure that the release notes are not empty if there is no rollback Because the empty list was returned for the list of hashes to ignore, we matching all the lines in the following grep. By adding a dummy hashes, it ensure that list is never empty and we thus never give a match all pattern. Change-Id: Ic5446c16b56633805e61b24ad71b67029a7b01e3 PiperOrigin-RevId: 172321625 --- scripts/release/relnotes.sh | 2 +- scripts/release/relnotes_test.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/release/relnotes.sh b/scripts/release/relnotes.sh index e72d3d42e8..8c342b2ddd 100755 --- a/scripts/release/relnotes.sh +++ b/scripts/release/relnotes.sh @@ -64,7 +64,7 @@ function get_release_notes_commits() { | grep -E '^[a-z0-9]+ Rollback of commit [a-z0-9]+.$' || true) local rollback_hashes=$(echo "$rollback_commits" | cut -d " " -f 1) local rolledback_hashes=$(echo "$rollback_commits" | cut -d " " -f 5 | sed -E 's/^(.......).*$/\1/') - local exclude_hashes=$(echo $cherry_picks $rollback_hashes $rolledback_hashes | xargs echo | sed 's/ /|/g') + local exclude_hashes=$(echo DUMMY $cherry_picks $rollback_hashes $rolledback_hashes | xargs echo | sed 's/ /|/g') git log --reverse --pretty=format:%H ${baseline}.. -E --grep='^RELNOTES(\[[^\]+\])?:' \ | grep -Ev "^(${exclude_hashes})" || true } diff --git a/scripts/release/relnotes_test.sh b/scripts/release/relnotes_test.sh index a3c8cebf6e..66adf700e5 100755 --- a/scripts/release/relnotes_test.sh +++ b/scripts/release/relnotes_test.sh @@ -239,4 +239,16 @@ function test_extract_release_note_for_post_copybara_commits() { assert_equals "${expected}" "${actual}" } +function test_commit_list_no_rollback() { + git checkout -q 2ea4fa26281175c316651ec50784b820a9f409cf + local expected='7c672ac643dd59bf4b3e284c6ad019c54545492f +0257c29f496719bb8414d012334155de6bbefa11 +a9c46e5907be66248b6218ae70e0a1d999c696d5 +78927792c77a6468607e215034c22b0641553f77 +8882192897fa3453d51fe907d19f948215a581af +2ea4fa26281175c316651ec50784b820a9f409cf' + local actual="$(get_release_notes_commits 7c605cf6ea9755a06e5abb16a631faac8ebe2937)" + assert_equals "${expected}" "${actual}" +} + run_suite "Release notes generation tests" -- cgit v1.2.3