Raymond Toy pushed to branch issue-464-lisp-version-uses-branch-name at cmucl / cmucl Commits: 47db53d7 by Raymond Toy at 2026-01-15T18:08:03-08:00 Prefix the version with CI if it was built via CI - - - - - f41a1277 by Raymond Toy at 2026-01-15T18:13:10-08:00 Use CASE statement instead of sequence of if/elif This makes it easier to read and lets us do some globbing to match the git hash which is easier than using regexp with `expr`. - - - - - 1 changed file: - bin/git-version.sh Changes: ===================================== bin/git-version.sh ===================================== @@ -44,22 +44,29 @@ else GIT_HASH="`echo ${GIT_DESC} | sed 's;^[^/]\+/;;' 2>/dev/null`" BRANCH="`git rev-parse --abbrev-ref HEAD`*" - if [ `expr "X$GIT_HASH" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]'` != 0 ]; then - # The git hash looks like snapshot-yyyy-mm-<stuff>. Remove the - # "snapshot-" part. - DEFAULT_VERSION=`expr "$GIT_HASH" : "snapshot-\(.*\)"` - elif [ `expr "X$GIT_HASH" : 'X[0-9][0-9][a-f]'` != 0 ]; then - # The git hash looks like a release which is 3 hex digits. Use it as is. - DEFAULT_VERSION="${GIT_HASH}" - elif [ `expr "${GIT_HASH}" : "${BRANCH}"` != 0 ]; then - # The hash looks like the current branch with possibly more - # stuff at the end. Use the hash as the version. - DEFAULT_VERSION="${GIT_HASH}" - elif [ `expr "${GIT_HASH}" : "[0-9]*"` != 0 ]; then - # Assuming this is CI which seems to produce a githash like - # "pipeline/<digits>". - DEFAULT_VERSION="${GIT_HASH}" - fi + case "$GIT_HASH" in + snapshot-[0-9][0-9][0-9][0-9]-[01][0-9]) + # The git hash looks like snapshot-yyyy-mm-<stuff>. Remove the + # "snapshot-" part. + DEFAULT_VERSION=`expr "$GIT_HASH" : "snapshot-\(.*\)"` + ;; + [0-9][0-9][a-f]) + # The git hash looks like a release which is 3 hex digits. + # Use it as is. + DEFAULT_VERSION="${GIT_HASH}" + ;; + ${BRANCH}*) + # The hash looks like the current branch with possibly more + # stuff at the end. Use the hash as the version. + DEFAULT_VERSION="${GIT_HASH}" + ;; + [0-9]*) + # Assuming this is CI which seems to produce a githash like + # "pipeline/<digits>". Make the version include "ci-" so we + # know this was done via CI. + DEFAULT_VERSION="ci-${GIT_HASH}" + ;; + esac if [ -z "$DEFAULT_VERSION" ]; then echo "Unable to determine a default version from git describe: $GIT_DESC" View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/800cf0dbf497725bbb432fd... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/800cf0dbf497725bbb432fd... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)