From 81a30ec3a72bf948ac17bc145bd9f7cda3884ad4 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 11 May 2020 23:47:12 +0200 Subject: [PATCH] util/release: Check that HEAD isn't used as reference genrelnotes moves the tree between commits and so a relative location like HEAD isn't stable. Since I ran into the HEAD issue while preparing for two consecutive releases, let's guard against it. Change-Id: I70c6812cdfe0d0671b3d653744a062d9920a2394 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/41339 Reviewed-by: Paul Menzel Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- util/release/genrelnotes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/release/genrelnotes b/util/release/genrelnotes index 54933b0a59..5bd1a965e5 100755 --- a/util/release/genrelnotes +++ b/util/release/genrelnotes @@ -47,6 +47,11 @@ if [ "$1" == "--help" ] || [ -z "$1" ] || [ -z "$2" ]; then else OLD_GIT_VERSION="$1" NEW_GIT_VERSION="$2" + if [ "$OLD_GIT_VERSION" = "HEAD" -o "$NEW_GIT_VERSION" = "HEAD" ]; then + echo "Error: using HEAD as a reference doesn't work" + echo + exit 1 + fi TOTAL_COMMITS=$(git log --pretty=oneline \ "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l) fi