Raymond Toy pushed to branch issue-464-lisp-version-uses-branch-name at cmucl / cmucl Commits: 9467db45 by Raymond Toy at 2026-02-08T12:02:18-08:00 Do something different for the master branch On the master branch, use the version from "git describe --dirty". This way, the version for builds on the master branch can be distinguished by the number of commits since the last release/tag. Otherwise, we'll use the most recent tag or branch name, as before. - - - - - 1 changed file: - bin/git-version.sh Changes: ===================================== bin/git-version.sh ===================================== @@ -36,37 +36,39 @@ if [ -n "$VERSION" ]; then GIT_HASH="$VERSION" DEFAULT_VERSION="$VERSION" else - # The option --all allows use to use the the branch name or tag - # name as appropriate. This is much more informative. However, - # we have to remove everything before the first slash which - # contains things like "tag/" or "head/". - GIT_DESC="`git describe --all --dirty || git describe 2>/dev/null`" - GIT_HASH="`echo ${GIT_DESC} | sed 's;^[^/]*/;;' 2>/dev/null`" - BRANCH="`git rev-parse --abbrev-ref HEAD`*" + # Get the current branch. + BRANCH="`git rev-parse --abbrev-ref HEAD`" + if [ "$BRANCH" = "master" ]; then + # On the master branch, use simple git describe --dirty for the version + DEFAULT_VERSION="`git describe --all || git describe 2>/dev/null`" + else + # We're not on the master branch. Do something different. + # The option --all allows use to use the the branch name or tag + # name as appropriate. This is much more informative. However, + # we have to remove everything before the first slash which + # contains things like "tag/" or "head/". + GIT_DESC="`git describe --all --dirty || git describe 2>/dev/null`" + GIT_HASH="`echo ${GIT_DESC} | sed 's;^[^/]*/;;' 2>/dev/null`" - 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 + 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}" + ;; + [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 + fi 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/-/commit/9467db45738f62bf9e06d4ce... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/9467db45738f62bf9e06d4ce... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)