Raymond Toy pushed to branch issue-464-lisp-version-uses-branch-name at cmucl / cmucl Commits: b25818a4 by Raymond Toy at 2026-02-27T07:01:17-08:00 If we're on a branch, use the branch name. Get rid of the last pattern in the case statement. If we don't know how to handle it we should complain. - - - - - 9dfa5a3f by Raymond Toy at 2026-02-27T07:08:29-08:00 Put back the default case We'll use whatever we get if it doesn't match the previous cases to handle the case where we're checked out at some random git hash. As the comments say, the version will be something like "closest-branch-nn-gxxxxxx", where "nn" is the number of commits after the "closest-branch" and "xxxxxx" is the git hash of our checkout. - - - - - 1 changed file: - bin/git-version.sh Changes: ===================================== bin/git-version.sh ===================================== @@ -37,16 +37,20 @@ if [ -n "$VERSION" ]; then DEFAULT_VERSION="$VERSION" else # Get the current branch. - BRANCH="`git rev-parse --abbrev-ref HEAD`" + BRANCH="`git branch --show-current`" if [ "$BRANCH" = "master" ]; then # On the master branch, use simple git describe --dirty for the version DEFAULT_VERSION="`git describe --dirty || git describe 2>/dev/null`" + elif [ -n "$BRANCH" ]; then + # We're on some branch. Just use the branch name. + DEFAULT_VERSION="$BRANCH" 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/". + # We're not on a branch. We need to 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 "tags/", "head/", or "pipelines/" + # (from CI). GIT_DESC="`git describe --all --dirty || git describe 2>/dev/null`" GIT_HASH="`echo ${GIT_DESC} | sed 's;^[^/]*/;;' 2>/dev/null`" @@ -68,7 +72,11 @@ else DEFAULT_VERSION="ci-${GIT_HASH}" ;; *) - # Everything else is taken as is. + # Use whatever we have. This handles the case where + # we're checked on some git hash. In that we we have + # "head/closest-branch-nn-gxxxxxx" where nn is the + # number of commits after the closest branch and + # xxxxxx is the git hash. DEFAULT_VERSION="${GIT_HASH}" ;; esac View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/8bba47ecc6c04ab9f9c701d... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/8bba47ecc6c04ab9f9c701d... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)