From a8d40481969c99b96db353352b2c5d895c4291d1 Mon Sep 17 00:00:00 2001 From: Ryan Brue Date: Sep 26 2024 22:26:09 +0000 Subject: fix(scripts): set SHORTCOMMIT after final COMMIT assignment this fixes an issue where tags as commits (i.e. epoch-1.0.0-alpha.2) would be given a shortcommit before resolving the actual commit (so SHORTCOMMIT=epoch-1.) Signed-off-by: Ryan Brue --- diff --git a/scripts/srpm.sh b/scripts/srpm.sh index e670fa1..3221e32 100755 --- a/scripts/srpm.sh +++ b/scripts/srpm.sh @@ -38,13 +38,12 @@ if [[ "$COMMIT" == "latest" ]]; then COMMIT=$(git rev-parse HEAD) fi -SHORTCOMMIT=$(echo ${COMMIT:0:7}) - git reset --hard $COMMIT # Ensure commit is set to the current head of the local repo # This is needed because if we reset to a tag, we want the commit to be in the commit field later on (for VERGEN) COMMIT=$(git rev-parse HEAD) +SHORTCOMMIT=$(echo ${COMMIT:0:7}) COMMITDATE=$(git log -1 --format=%cd --date=format:%Y%m%d) COMMITDATESTRING=$(git log -1 --format=%cd --date=iso)