From 970981741dfad8dae8d5dca0d0e65a65dcc2b863 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 17 Mar 2021 17:10:52 -0400 Subject: [PATCH] Bail out of update-version script when commit hash already matches --- update-version | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/update-version b/update-version index 8d123e2..b8832fc 100755 --- a/update-version +++ b/update-version @@ -33,6 +33,27 @@ fi SRCDIR="$(cd "$(dirname "$0")"; pwd)" SPEC="${SRCDIR}/gn.spec" +SPEC_COMMIT="$( + awk '/^%global[[:blank:]]+commit[[:blank:]]+[[:xdigit:]]{40}[[:blank:]]*$/ { + print $3; exit + }' "${SPEC}" +)" + +check_equal_commits() { + if [ "${1}" = "${SPEC_COMMIT}" ] + then + cat 1>&2 </dev/null +then + check_equal_commits "${COMMIT}" +fi + tmpd="$(mktemp -d)" trap "rm -rf '${tmpd}'" INT TERM EXIT @@ -42,6 +63,7 @@ cd gn if ! echo "${COMMIT}" | grep -E '^[[:xdigit:]]{40}$' >/dev/null then COMMIT="$(git rev-parse "${COMMIT}")" + check_equal_commits "${COMMIT}" fi git checkout "${COMMIT}" python3 './build/gen.py'