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 <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41339
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Georgi 2020-05-11 23:47:12 +02:00
parent d906b21e2e
commit 81a30ec3a7
1 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,11 @@ if [ "$1" == "--help" ] || [ -z "$1" ] || [ -z "$2" ]; then
else else
OLD_GIT_VERSION="$1" OLD_GIT_VERSION="$1"
NEW_GIT_VERSION="$2" 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 \ TOTAL_COMMITS=$(git log --pretty=oneline \
"${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l) "${OLD_GIT_VERSION}..${NEW_GIT_VERSION}" 2>/dev/null | wc -l)
fi fi